debugging

This commit is contained in:
John Smith
2021-12-14 09:48:33 -05:00
parent 8fe99f6090
commit c4b66aad36
23 changed files with 411 additions and 143 deletions
+11 -4
View File
@@ -64,7 +64,9 @@ impl ConnectionTable {
&self,
descriptor: ConnectionDescriptor,
conn: NetworkConnection,
) -> Result<ConnectionTableEntry, ()> {
) -> Result<ConnectionTableEntry, String> {
trace!("descriptor: {:?}", descriptor);
assert_ne!(
descriptor.protocol_type(),
ProtocolType::UDP,
@@ -73,7 +75,10 @@ impl ConnectionTable {
let mut inner = self.inner.lock();
if inner.conn_by_addr.contains_key(&descriptor) {
return Err(());
return Err(format!(
"Connection already added to table: {:?}",
descriptor
));
}
let timestamp = get_timestamp();
@@ -106,13 +111,15 @@ impl ConnectionTable {
pub fn remove_connection(
&self,
descriptor: &ConnectionDescriptor,
) -> Result<ConnectionTableEntry, ()> {
) -> Result<ConnectionTableEntry, String> {
trace!("descriptor: {:?}", descriptor);
let mut inner = self.inner.lock();
let res = inner.conn_by_addr.remove(descriptor);
match res {
Some(v) => Ok(v),
None => Err(()),
None => Err(format!("Connection not in table: {:?}", descriptor)),
}
}
}