port latest v0 commits to refactor and general code cleanup
Some checks failed
Build and Test / mario-tennis (push) Has been cancelled
Build and Test / sonic-transformed (push) Has been cancelled
Build and Test / friends (push) Has been cancelled
Build and Test / fast-racing-neo (push) Has been cancelled
Build and Test / wii-sports-club (push) Has been cancelled
Build and Test / splatoon (push) Has been cancelled
Build and Test / puyopuyo (push) Has been cancelled
Build and Test / minecraft-wiiu (push) Has been cancelled
Build and Test / super-mario-maker (push) Has been cancelled
Build and Test / wii-u-chat (push) Has been cancelled
Build and Test / splatoon-testfire (push) Has been cancelled
Some checks failed
Build and Test / mario-tennis (push) Has been cancelled
Build and Test / sonic-transformed (push) Has been cancelled
Build and Test / friends (push) Has been cancelled
Build and Test / fast-racing-neo (push) Has been cancelled
Build and Test / wii-sports-club (push) Has been cancelled
Build and Test / splatoon (push) Has been cancelled
Build and Test / puyopuyo (push) Has been cancelled
Build and Test / minecraft-wiiu (push) Has been cancelled
Build and Test / super-mario-maker (push) Has been cancelled
Build and Test / wii-u-chat (push) Has been cancelled
Build and Test / splatoon-testfire (push) Has been cancelled
This commit is contained in:
parent
22252c929c
commit
a709fd0a61
12 changed files with 125 additions and 88 deletions
|
|
@ -1,5 +1,3 @@
|
|||
use std::io::Write;
|
||||
|
||||
use hmac::Mac;
|
||||
use md5::{Digest, Md5};
|
||||
use rc4::{KeyInit, Rc4, StreamCipher};
|
||||
|
|
@ -8,7 +6,6 @@ use rnex_prudp::{
|
|||
types_flags::{TypesFlags, types::DATA},
|
||||
};
|
||||
use rnex_util::PID;
|
||||
use typenum::U5;
|
||||
|
||||
use crate::crypto::{
|
||||
Crypto, CryptoInstance,
|
||||
|
|
|
|||
|
|
@ -8,9 +8,6 @@ use rnex_prudp::{
|
|||
};
|
||||
use rnex_rmc::serialization::RmcSerialize;
|
||||
use rnex_util::{PID, account::Account};
|
||||
use std::io::Write;
|
||||
use typenum::U16;
|
||||
|
||||
use crate::crypto::{
|
||||
Crypto, CryptoInstance,
|
||||
common_crypto::common_checksum,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ pub struct InternalConnection<C: CryptoInstance> {
|
|||
server_packet_counter: u16,
|
||||
client_packet_counter: u16,
|
||||
unacknowledged_packets: HashMap<u16, Arc<Vec<u8>>>,
|
||||
packet_buffer: Vec<u8>,
|
||||
packet_queue: HashMap<u16, (Instant, PRUDPV0Packet<Vec<u8>>)>,
|
||||
}
|
||||
pub struct Connection<C: CryptoInstance> {
|
||||
|
|
@ -94,7 +95,7 @@ impl<C: Crypto> Server<C> {
|
|||
.expect("packet malformed in creation"),
|
||||
);*/
|
||||
let mut inner = conn.inner.lock().await;
|
||||
let pieces = data.chunks(700);
|
||||
let pieces = data.chunks(962);
|
||||
let max_piece = pieces.len() - 1;
|
||||
let mut frag_num = 1;
|
||||
for (i, piece) in pieces.enumerate() {
|
||||
|
|
@ -139,8 +140,18 @@ impl<C: Crypto> Server<C> {
|
|||
.await
|
||||
.ok();
|
||||
|
||||
break;
|
||||
sleep(Duration::from_millis(500)).await;
|
||||
}
|
||||
println!("connection exceeded max fail count, disconnecting");
|
||||
let Some(conn) = conn.upgrade() else {
|
||||
return;
|
||||
};
|
||||
let Some(this) = this.upgrade() else {
|
||||
return;
|
||||
};
|
||||
let mut conns = this.connections.write().await;
|
||||
conns.remove(&(conn.addr, conn.session_id));
|
||||
drop(conns);
|
||||
});
|
||||
frag_num += 1;
|
||||
}
|
||||
|
|
@ -279,6 +290,7 @@ impl<C: Crypto> Server<C> {
|
|||
client_packet_counter: 2,
|
||||
server_packet_counter: 1,
|
||||
unacknowledged_packets: HashMap::new(),
|
||||
packet_buffer: vec![],
|
||||
packet_queue: HashMap::new(),
|
||||
}),
|
||||
});
|
||||
|
|
@ -332,6 +344,12 @@ impl<C: Crypto> Server<C> {
|
|||
warn!("data packet on inactive connection from: {:?}", addr);
|
||||
return;
|
||||
};
|
||||
if header.type_flags.get_flags() & ACK != 0 {
|
||||
let mut inner = res.inner.lock().await;
|
||||
let sequence_id = header.sequence_id;
|
||||
inner.unacknowledged_packets.remove(&sequence_id);
|
||||
return;
|
||||
}
|
||||
info!("frag: {}", frag_id);
|
||||
let mut conn = res.inner.lock().await;
|
||||
let ack = new_data_packet(
|
||||
|
|
@ -366,9 +384,16 @@ impl<C: Crypto> Server<C> {
|
|||
};
|
||||
|
||||
conn.crypto_instance.decrypt_incoming(payload);
|
||||
|
||||
res.target.send(payload.to_owned()).await;
|
||||
conn.packet_buffer.extend_from_slice(payload);
|
||||
conn.client_packet_counter += 1;
|
||||
if *packet.fragment_id().unwrap() != 0 {
|
||||
info!("handeling fragmented packet");
|
||||
continue;
|
||||
}
|
||||
|
||||
res.target
|
||||
.send(std::mem::take(&mut conn.packet_buffer))
|
||||
.await;
|
||||
}
|
||||
info!("finished handeling packets, dropping inner connection");
|
||||
drop(conn);
|
||||
|
|
@ -470,8 +495,8 @@ impl<C: Crypto> Server<C> {
|
|||
inner.last_action = Instant::now();
|
||||
drop(inner);
|
||||
};
|
||||
if header.type_flags.get_flags() & ACK != 0 {
|
||||
info!("got ack(acks are ignored for now)");
|
||||
if header.type_flags.get_flags() & ACK != 0 && header.type_flags.get_types() != DATA {
|
||||
info!("got ack(acks are ignored for now, unless they are data ACKs)");
|
||||
return;
|
||||
}
|
||||
println!("{:?}", header);
|
||||
|
|
|
|||
|
|
@ -43,13 +43,17 @@ struct InternalConnection<E: CryptoHandlerConnectionInstance> {
|
|||
connections: Weak<Mutex<BTreeMap<PRUDPSockAddr, Arc<InternalConnectionMutex<E>>>>>,
|
||||
reliable_server_counter: u16,
|
||||
reliable_client_counter: u16,
|
||||
// i'm a bit scared things might break if i remove this
|
||||
#[allow(dead_code)]
|
||||
supported_function_version: u32,
|
||||
#[deny(dead_code)]
|
||||
// maybe add connection id(need to see if its even needed)
|
||||
crypto_handler_instance: E,
|
||||
data_sender: Sender<Vec<u8>>,
|
||||
socket: Arc<UdpSocket>,
|
||||
packet_queue: HashMap<u16, PRUDPV1Packet>,
|
||||
last_packet_time: Instant,
|
||||
partial_packet: Vec<u8>,
|
||||
unacknowleged_packets: Vec<(Instant, PRUDPV1Packet)>,
|
||||
}
|
||||
|
||||
|
|
@ -431,6 +435,7 @@ impl<T: CryptoHandler> InternalSocket<T> {
|
|||
packet_queue: Default::default(),
|
||||
last_packet_time: Instant::now(),
|
||||
unacknowleged_packets: Vec::new(),
|
||||
partial_packet: Vec::new(),
|
||||
supported_function_version,
|
||||
};
|
||||
|
||||
|
|
@ -574,10 +579,25 @@ impl<T: CryptoHandler> InternalSocket<T> {
|
|||
conn.crypto_handler_instance
|
||||
.decrypt_incoming(packet.header.substream_id, &mut packet.payload[..]);
|
||||
|
||||
conn.data_sender.send(packet.payload).await.ok();
|
||||
conn.partial_packet
|
||||
.extend_from_slice(&mut packet.payload[..]);
|
||||
|
||||
conn.reliable_client_counter = conn.reliable_client_counter.overflowing_add(1).0;
|
||||
counter = conn.reliable_client_counter;
|
||||
if packet.options.iter().any(|v| {
|
||||
if let FragmentId(f) = v {
|
||||
*f != 0
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}) {
|
||||
println!("handeling fragmented packet");
|
||||
continue;
|
||||
}
|
||||
|
||||
let packet = std::mem::take(&mut conn.partial_packet);
|
||||
|
||||
conn.data_sender.send(packet).await.ok();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -690,19 +710,7 @@ impl<T: CryptoHandler> AnyInternalSocket for InternalSocket<T> {
|
|||
let conn = &**conn;
|
||||
let mut conn = conn.lock().await;
|
||||
|
||||
if conn.supported_function_version == 1 {
|
||||
let mut collected_ids: Vec<u16> = Vec::new();
|
||||
let mut cursor = Cursor::new(&packet.payload);
|
||||
|
||||
while let Ok(v) = read_u16(&mut cursor) {
|
||||
collected_ids.push(v);
|
||||
}
|
||||
|
||||
conn.unacknowleged_packets.retain_mut(|(_, up)| {
|
||||
!(collected_ids.iter().any(|id| up.header.sequence_id == *id)
|
||||
|| up.header.sequence_id <= packet.header.sequence_id)
|
||||
});
|
||||
} else {
|
||||
if packet.header.substream_id == 1 {
|
||||
let mut collected_ids: Vec<u16> = Vec::new();
|
||||
let mut cursor = Cursor::new(&packet.payload);
|
||||
|
||||
|
|
@ -729,10 +737,22 @@ impl<T: CryptoHandler> AnyInternalSocket for InternalSocket<T> {
|
|||
collected_ids.push(additional_sequence_id);
|
||||
}
|
||||
|
||||
conn.unacknowleged_packets.retain_mut(|(_, up)| {
|
||||
conn.unacknowleged_packets.retain(|(_, up)| {
|
||||
!(collected_ids.iter().any(|id| up.header.sequence_id == *id)
|
||||
|| up.header.sequence_id <= sequence_id)
|
||||
});
|
||||
} else {
|
||||
let mut collected_ids: Vec<u16> = Vec::new();
|
||||
let mut cursor = Cursor::new(&packet.payload);
|
||||
|
||||
while let Ok(v) = read_u16(&mut cursor) {
|
||||
collected_ids.push(v);
|
||||
}
|
||||
|
||||
conn.unacknowleged_packets.retain(|(_, up)| {
|
||||
!(collected_ids.iter().any(|id| up.header.sequence_id == *id)
|
||||
|| up.header.sequence_id <= packet.header.sequence_id)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
error!("non connection acknowledgement packet on nonexistent connection...")
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ impl AuthHandler {
|
|||
.map_err(|_| ErrorCode::RendezVous_InvalidPassword)?;
|
||||
info!("source login data");
|
||||
let source_login_data = (pid, passwd);
|
||||
println!("{}, {:?}", pid, passwd);
|
||||
info!("pid: {}, passwd: {:?}", pid, passwd);
|
||||
let destination_login_data = self.am.destination_server_acct.get_login_data();
|
||||
|
||||
info!("we are a-ok here");
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ impl Secure for BaseUser {
|
|||
station_urls: Vec<StationUrl>,
|
||||
) -> Result<(QResult, u32, StationUrl), ErrorCode> {
|
||||
let cid = self.cid;
|
||||
println!("{:?}", station_urls);
|
||||
info!("station URLs in register: {:?}", station_urls);
|
||||
|
||||
/*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ impl DatastoreUser {
|
|||
.fetch_optional(&self.dm.db_pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("Availability check DB error: {:?}", e);
|
||||
error!("error in db: {:?}", e);
|
||||
ErrorCode::DataStore_NotFound
|
||||
})?
|
||||
.ok_or(ErrorCode::DataStore_NotFound)?;
|
||||
|
|
@ -143,7 +143,7 @@ impl DatastoreUser {
|
|||
.fetch_all(&self.dm.db_pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("Ratings fetch error: {:?}", e);
|
||||
error!("Ratings fetch error: {:?}", e);
|
||||
ErrorCode::DataStore_NotFound
|
||||
})?;
|
||||
|
||||
|
|
@ -883,7 +883,7 @@ impl DataStore for DatastoreUser {
|
|||
.fetch_optional(&self.dm.db_pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("select error: {:?}", e);
|
||||
error!("select error: {:?}", e);
|
||||
ErrorCode::DataStore_NotFound
|
||||
})?;
|
||||
|
||||
|
|
@ -905,7 +905,7 @@ impl DataStore for DatastoreUser {
|
|||
.execute(&self.dm.db_pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("update error: {:?}", e);
|
||||
error!("update error: {:?}", e);
|
||||
ErrorCode::DataStore_NotFound
|
||||
})?;
|
||||
} else {
|
||||
|
|
@ -1032,9 +1032,9 @@ impl DataStore for DatastoreUser {
|
|||
&self,
|
||||
custom_ranking_param: DataStoreGetCustomRankingByDataIDParam,
|
||||
) -> Result<(Vec<DataStoreCustomRankingResult>, Vec<QResult>), ErrorCode> {
|
||||
println!("appid: {:?}", custom_ranking_param.application_id);
|
||||
println!("dataid list: {:?}", custom_ranking_param.data_id_list);
|
||||
println!("result option: {:?}", custom_ranking_param.result_option);
|
||||
info!("appid: {:?}", custom_ranking_param.application_id);
|
||||
info!("dataid list: {:?}", custom_ranking_param.data_id_list);
|
||||
info!("result option: {:?}", custom_ranking_param.result_option);
|
||||
|
||||
let mut ranking_results = self
|
||||
.get_custom_rankings_by_data_ids(
|
||||
|
|
@ -1415,7 +1415,7 @@ impl DataStore for DatastoreUser {
|
|||
.execute(&self.dm.db_pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("update error: {:?}", e);
|
||||
error!("update error: {:?}", e);
|
||||
ErrorCode::DataStore_NotFound
|
||||
})?;
|
||||
}
|
||||
|
|
@ -1431,7 +1431,7 @@ impl DataStore for DatastoreUser {
|
|||
.execute(&self.dm.db_pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("update error: {:?}", e);
|
||||
error!("update error: {:?}", e);
|
||||
ErrorCode::DataStore_NotFound
|
||||
})?;
|
||||
}
|
||||
|
|
@ -1447,7 +1447,7 @@ impl DataStore for DatastoreUser {
|
|||
.execute(&self.dm.db_pool)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
eprintln!("update error: {:?}", e);
|
||||
error!("update error: {:?}", e);
|
||||
ErrorCode::DataStore_NotFound
|
||||
})?;
|
||||
}
|
||||
|
|
@ -1503,7 +1503,7 @@ impl DataStore for DatastoreUser {
|
|||
.fetch(&self.dm.db_pool);
|
||||
|
||||
while let Some(row) = stream.try_next().await.map_err(|e| {
|
||||
eprintln!("stream error: {:?}", e);
|
||||
error!("stream error: {:?}", e);
|
||||
ErrorCode::DataStore_NotFound
|
||||
})? {
|
||||
let permission = Permission {
|
||||
|
|
@ -1904,7 +1904,7 @@ impl DataStore for DatastoreUser {
|
|||
.fetch(&self.dm.db_pool);
|
||||
|
||||
while let Some(row) = stream.try_next().await.map_err(|e| {
|
||||
eprintln!("stream error: {:?}", e);
|
||||
error!("stream error: {:?}", e);
|
||||
ErrorCode::DataStore_NotFound
|
||||
})? {
|
||||
let permission = Permission {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use rnex_fpd_protos::{
|
|||
},
|
||||
};
|
||||
use rnex_rmc::{any::Any, data::Data, qbuffer::QBuffer, response::ErrorCode, rmc_struct};
|
||||
use rnex_server::{PassthroughInitModule, WeakPassthroughInitModule};
|
||||
use rnex_server::PassthroughInitModule;
|
||||
use rnex_util::{PID, date_time::DateTime};
|
||||
use sqlx::query;
|
||||
use tokio::{spawn, sync::RwLock, time::sleep};
|
||||
|
|
@ -448,7 +448,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
)
|
||||
.fetch_one(&self.fm.db)
|
||||
.await else {
|
||||
println!("psql failed(unable to update user)");
|
||||
error!("psql failed(unable to update user)");
|
||||
return Err(ErrorCode::Core_SystemError)
|
||||
};
|
||||
|
||||
|
|
@ -469,7 +469,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.map(|v| friend_request_from_record!(v))
|
||||
.collect::<Vec<_>>()
|
||||
}) else {
|
||||
println!("error whilest getting friend requests");
|
||||
error!("error whilest getting friend requests");
|
||||
return Err(ErrorCode::Core_SystemError);
|
||||
};
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.map(|v| friend_request_from_record!(v))
|
||||
.collect::<Vec<_>>()
|
||||
}) else {
|
||||
println!("error whilest getting friend requests");
|
||||
error!("error whilest getting friend requests");
|
||||
return Err(ErrorCode::Core_SystemError);
|
||||
};
|
||||
|
||||
|
|
@ -517,7 +517,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_all(&self.fm.db)
|
||||
.await
|
||||
else {
|
||||
println!("error whilest getting friends");
|
||||
error!("error whilest getting friends");
|
||||
return Err(ErrorCode::Core_SystemError);
|
||||
};
|
||||
|
||||
|
|
@ -525,7 +525,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
|
||||
for friend in friends_raw {
|
||||
let Some(friend_since) = friend.since else {
|
||||
println!("this should absolutely never happen(psql messed up somehow)");
|
||||
error!("this should absolutely never happen(psql messed up somehow)");
|
||||
return Err(ErrorCode::Core_SystemError);
|
||||
};
|
||||
|
||||
|
|
@ -545,7 +545,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
if let Some(online_presence) = online_presence.as_ref() {
|
||||
presence = online_presence.clone();
|
||||
} else {
|
||||
println!(
|
||||
error!(
|
||||
"internal server error, user is somehow online and in the friends manager yet has not set their presence yet..."
|
||||
);
|
||||
}
|
||||
|
|
@ -595,7 +595,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
})
|
||||
.collect::<Vec<_>>()
|
||||
}) else {
|
||||
println!("error whilest getting friend requests");
|
||||
error!("error whilest getting friend requests");
|
||||
return Err(ErrorCode::Core_SystemError);
|
||||
};
|
||||
|
||||
|
|
@ -658,7 +658,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_optional(&self.fm.db)
|
||||
.await
|
||||
else {
|
||||
println!("db error when trying to look up nnid");
|
||||
error!("db error when trying to look up nnid");
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
};
|
||||
|
||||
|
|
@ -851,7 +851,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_one(&self.fm.db)
|
||||
.await
|
||||
else {
|
||||
println!("friend request count check failed to execute on database");
|
||||
error!("friend request count check failed to execute on database");
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
};
|
||||
if query.count.is_none_or(|v| v >= 100) {
|
||||
|
|
@ -864,7 +864,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_one(&self.fm.db)
|
||||
.await
|
||||
else {
|
||||
println!("friend request count check failed to execute on database");
|
||||
error!("friend request count check failed to execute on database");
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
};
|
||||
if query.count.is_none_or(|v| v >= 100) {
|
||||
|
|
@ -904,18 +904,18 @@ impl FriendsWiiU for FriendsUser {
|
|||
return Err(ErrorCode::FPD_AddFriendProhibited);
|
||||
}
|
||||
sqlx::error::ErrorKind::ForeignKeyViolation => {
|
||||
return Err(ErrorCode::FPD_NotNetworkAccount);
|
||||
return Err(ErrorCode::FPD_NotNetworkAccount); // incorrect error code, this is returned only by the system if the current user does not have an NNID
|
||||
}
|
||||
sqlx::error::ErrorKind::CheckViolation => {
|
||||
return Err(ErrorCode::FPD_FriendRequestNotAllowed);
|
||||
}
|
||||
_ => {
|
||||
println!("unknown db error occurred");
|
||||
error!("unknown db error occurred");
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("unknown db error occurred");
|
||||
error!("unknown db error occurred");
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
}
|
||||
};
|
||||
|
|
@ -933,7 +933,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_one(&self.fm.db)
|
||||
.await
|
||||
else {
|
||||
println!("failed to acquire account info after adding friend");
|
||||
warn!("failed to acquire account info after adding friend");
|
||||
return Err(ErrorCode::FPD_InvalidMessageID);
|
||||
};
|
||||
fr.basic_info = basic_principal_from_record!(query);
|
||||
|
|
@ -1028,7 +1028,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_one(&mut *tx)
|
||||
.await
|
||||
else {
|
||||
println!("failed to acquire account info after adding friend");
|
||||
warn!("failed to acquire account info after adding friend");
|
||||
return Err(ErrorCode::FPD_InvalidMessageID);
|
||||
};
|
||||
|
||||
|
|
@ -1054,7 +1054,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_one(&mut *tx)
|
||||
.await
|
||||
else {
|
||||
println!("internal server error whilest getting nna info");
|
||||
error!("internal server error whilest getting nna info");
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
};
|
||||
let data = Any::new(&friends_wiiu::FriendInfo {
|
||||
|
|
@ -1083,7 +1083,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
if let Some(online_presence) = online_presence.as_ref() {
|
||||
presence = online_presence.clone();
|
||||
} else {
|
||||
println!(
|
||||
error!(
|
||||
"internal server error, user is somehow online and in the friends manager yet has not set their presence yet..."
|
||||
);
|
||||
}
|
||||
|
|
@ -1175,7 +1175,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.execute(&self.fm.db)
|
||||
.await
|
||||
{
|
||||
println!("{}", e);
|
||||
error!("friend request denial db error: {}", e);
|
||||
return Err(ErrorCode::FPD_InvalidMessageID);
|
||||
};
|
||||
|
||||
|
|
@ -1204,7 +1204,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_one(&self.fm.db)
|
||||
.await
|
||||
else {
|
||||
println!("attempt to get invalid user which is in friend request");
|
||||
error!("attempt to get invalid user which is in friend request");
|
||||
return Err(ErrorCode::FPD_InvalidArgument);
|
||||
};
|
||||
|
||||
|
|
@ -1241,7 +1241,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.execute(&self.fm.db)
|
||||
.await
|
||||
{
|
||||
println!("{}", e);
|
||||
error!("failed to block user: {}", e);
|
||||
return Err(ErrorCode::FPD_InvalidMessageID);
|
||||
};
|
||||
|
||||
|
|
@ -1252,7 +1252,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_one(&self.fm.db)
|
||||
.await
|
||||
else {
|
||||
println!("attempt to get invalid user which is in friend request");
|
||||
error!("attempt to get invalid user which is in friend request");
|
||||
return Err(ErrorCode::FPD_InvalidArgument);
|
||||
};
|
||||
|
||||
|
|
@ -1273,7 +1273,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.execute(&self.fm.db)
|
||||
.await
|
||||
{
|
||||
println!("{}", e);
|
||||
error!("error removing blacklist: {}", e);
|
||||
return Err(ErrorCode::FPD_InvalidMessageID);
|
||||
};
|
||||
Ok(())
|
||||
|
|
@ -1332,7 +1332,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.execute(&self.fm.db)
|
||||
.await
|
||||
{
|
||||
println!("internal server error whilest updating mii: {}", e);
|
||||
error!("internal server error whilest updating mii: {}", e);
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
}
|
||||
|
||||
|
|
@ -1343,7 +1343,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.fetch_one(&self.fm.db)
|
||||
.await
|
||||
else {
|
||||
println!("internal server error whilest getting nna info");
|
||||
error!("internal server error whilest getting nna info");
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
};
|
||||
|
||||
|
|
@ -1378,7 +1378,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.execute(&self.fm.db)
|
||||
.await
|
||||
{
|
||||
println!("internal server error whilest updating mii: {}", e);
|
||||
error!("internal server error whilest updating mii: {}", e);
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
}
|
||||
|
||||
|
|
@ -1420,7 +1420,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
.execute(&self.fm.db)
|
||||
.await
|
||||
{
|
||||
println!("internal server error whilest updating mii: {e}");
|
||||
error!("internal server error whilest updating mii: {e}");
|
||||
return Err(ErrorCode::Core_Exception);
|
||||
}
|
||||
|
||||
|
|
@ -1483,7 +1483,7 @@ impl FriendsWiiU for FriendsUser {
|
|||
let mut principal_infos = Vec::with_capacity(pids.len());
|
||||
|
||||
for pid in pids {
|
||||
println!("looking up pid: {pid}");
|
||||
info!("looking up pid: {pid}");
|
||||
let Ok(user) = query!(
|
||||
"select * from nintendo_network_accounts where pid = $1",
|
||||
pid
|
||||
|
|
@ -1554,7 +1554,8 @@ impl FriendsWiiU for FriendsUser {
|
|||
}
|
||||
}
|
||||
|
||||
type HMacMd5 = hmac::Hmac<md5::Md5>;
|
||||
// unused?
|
||||
// type HMacMd5 = hmac::Hmac<md5::Md5>;
|
||||
|
||||
impl Drop for FriendsUser {
|
||||
fn drop(&mut self) {
|
||||
|
|
@ -1595,8 +1596,8 @@ impl AccountManagement for FriendsGuest {
|
|||
async fn nintendo_create_account(
|
||||
&self,
|
||||
principal_name: String,
|
||||
key: String,
|
||||
groups: u32,
|
||||
_key: String,
|
||||
_groups: u32,
|
||||
email: String,
|
||||
auth_data: Any,
|
||||
) -> Result<(PID, String), ErrorCode> {
|
||||
|
|
@ -1616,7 +1617,7 @@ impl AccountManagement for FriendsGuest {
|
|||
//let mac = derive_pid_hmac(data.nna_info.principal_basic_info.pid, &nexkey);
|
||||
|
||||
let mut client = grpc_client().await.map_err(|e| {
|
||||
eprintln!("error occurred: {e:?}");
|
||||
error!("error occurred in gRPC client: {e:?}");
|
||||
ErrorCode::Core_Unknown
|
||||
})?;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ use rnex_util::PID;
|
|||
use sqlx::PgPool;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
env,
|
||||
sync::{Arc, Weak, atomic::AtomicU32},
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
use thiserror::Error;
|
||||
use tokio::sync::RwLock;
|
||||
|
|
@ -69,10 +68,10 @@ impl RnexManager for FriendsManager {
|
|||
|
||||
async fn init_new_user(
|
||||
mgr: rnex_server::PassthroughInitModule<Self>,
|
||||
mod_holder: &rnex_server::ModuleHolder,
|
||||
_mod_holder: &rnex_server::ModuleHolder,
|
||||
remote: &rnex_rmc::RmcConnection,
|
||||
init_data: &Self::InitData,
|
||||
weak_user: WeakPassthroughInitModule<Self::User>,
|
||||
_weak_user: WeakPassthroughInitModule<Self::User>,
|
||||
) -> Self::User {
|
||||
if init_data.pid == GUEST_PID {
|
||||
return FriendsMaybeGuest::Guest(FriendsGuest);
|
||||
|
|
@ -95,7 +94,7 @@ impl RnexModule for FriendsModule {
|
|||
type InitError = ModuleInitError;
|
||||
|
||||
async fn create_manager(
|
||||
mod_holder: &rnex_server::ModuleHolder,
|
||||
_mod_holder: &rnex_server::ModuleHolder,
|
||||
) -> Result<Self::Manager, Self::InitError> {
|
||||
Ok(FriendsManager {
|
||||
users: Default::default(),
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ impl MatchmakeManager {
|
|||
}
|
||||
|
||||
if bool_matched_criteria {
|
||||
println!("matched session: {:?}", session);
|
||||
info!("matched session: {:?}", session);
|
||||
list.push(session.clone());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ impl MatchmakeExtension for MatchmakeUser {
|
|||
&self,
|
||||
create_session_param: CreateMatchmakeSessionParam,
|
||||
) -> Result<MatchmakeSession, ErrorCode> {
|
||||
println!("{:?}", create_session_param);
|
||||
info!("session paramater: {:?}", create_session_param);
|
||||
|
||||
let gid = self.matchmake_manager.next_gid();
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ impl MatchmakeExtension for MatchmakeUser {
|
|||
&self,
|
||||
param: AutoMatchmakeParam,
|
||||
) -> Result<MatchmakeSession, ErrorCode> {
|
||||
println!("{:?}", param);
|
||||
info!("autommparam: {:?}", param);
|
||||
|
||||
let mut joining_players = vec![self.this.clone()];
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ impl MatchmakeExtension for MatchmakeUser {
|
|||
|
||||
drop(sessions);
|
||||
|
||||
println!("making new session!");
|
||||
info!("making new session!");
|
||||
|
||||
let AutoMatchmakeParam {
|
||||
join_message,
|
||||
|
|
@ -398,7 +398,7 @@ impl MatchmakeExtension for MatchmakeUser {
|
|||
else {
|
||||
return Err(ErrorCode::Core_InvalidArgument);
|
||||
};
|
||||
println!("notif ty : {}", ty);
|
||||
info!("notif ty : {}", ty);
|
||||
match ty {
|
||||
REQUEST_JOIN_GATHERING => {
|
||||
user.remote
|
||||
|
|
@ -476,7 +476,7 @@ impl MatchmakeExtension for MatchmakeUser {
|
|||
) -> Result<Any<Gathering>, ErrorCode> {
|
||||
let session: MatchmakeSession = gathering.try_get_as()?;
|
||||
|
||||
println!("{:?}", criteria);
|
||||
info!("automm criteria: {:?}", criteria);
|
||||
|
||||
let session = self
|
||||
.auto_matchmake_with_param_postpone(AutoMatchmakeParam {
|
||||
|
|
@ -525,7 +525,7 @@ impl Matchmake for MatchmakeUser {
|
|||
.ok_or(ErrorCode::RendezVous_SessionClosed)?
|
||||
.await;
|
||||
|
||||
println!("{:?}", urls);
|
||||
info!("getsessionURLs: {:?}", urls);
|
||||
|
||||
if urls.is_empty() {
|
||||
return Err(ErrorCode::RendezVous_NotParticipatedGathering);
|
||||
|
|
@ -685,7 +685,7 @@ impl NatTraversal for MatchmakeUser {
|
|||
) -> Result<(), ErrorCode> {
|
||||
let users = self.matchmake_manager.users.read().await;
|
||||
|
||||
println!(
|
||||
info!(
|
||||
"requesting station probe for {:?} to {:?}",
|
||||
target_list, station_to_probe
|
||||
);
|
||||
|
|
|
|||
|
|
@ -90,8 +90,6 @@ impl Ranking for RankingUser {
|
|||
team_votes,
|
||||
};
|
||||
|
||||
println!("range: {:?}", param.range);
|
||||
|
||||
Ok(vec![info])
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue