Skip to content

Commit

Permalink
Remove closing from TransportPeerEventHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierHecart committed Sep 25, 2024
1 parent 3abde56 commit 512a372
Show file tree
Hide file tree
Showing 20 changed files with 2 additions and 68 deletions.
4 changes: 0 additions & 4 deletions io/zenoh-transport/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ impl TransportEventHandler for DummyTransportEventHandler {
/*************************************/
pub trait TransportMulticastEventHandler: Send + Sync {
fn new_peer(&self, peer: TransportPeer) -> ZResult<Arc<dyn TransportPeerEventHandler>>;
fn closing(&self);
fn closed(&self);
fn as_any(&self) -> &dyn Any;
}
Expand All @@ -95,7 +94,6 @@ impl TransportMulticastEventHandler for DummyTransportMulticastEventHandler {
fn new_peer(&self, _peer: TransportPeer) -> ZResult<Arc<dyn TransportPeerEventHandler>> {
Ok(Arc::new(DummyTransportPeerEventHandler))
}
fn closing(&self) {}
fn closed(&self) {}
fn as_any(&self) -> &dyn Any {
self
Expand All @@ -121,7 +119,6 @@ pub trait TransportPeerEventHandler: Send + Sync {
fn handle_message(&self, msg: NetworkMessage) -> ZResult<()>;
fn new_link(&self, src: Link);
fn del_link(&self, link: Link);
fn closing(&self);
fn closed(&self);
fn as_any(&self) -> &dyn Any;
}
Expand All @@ -137,7 +134,6 @@ impl TransportPeerEventHandler for DummyTransportPeerEventHandler {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
5 changes: 0 additions & 5 deletions io/zenoh-transport/src/multicast/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,7 @@ impl TransportMulticastInner {
pub(super) async fn delete(&self) -> ZResult<()> {
tracing::debug!("Closing multicast transport on {:?}", self.locator);

// Notify the callback that we are going to close the transport
let callback = zwrite!(self.callback).take();
if let Some(cb) = callback.as_ref() {
cb.closing();
}

// Delete the transport on the manager
let _ = self.manager.del_transport_multicast(&self.locator).await;
Expand Down Expand Up @@ -441,7 +437,6 @@ impl TransportMulticastInner {

// TODO(yuyuan): Unify the termination
peer.token.cancel();
peer.handler.closing();
drop(guard);
peer.handler.closed();
}
Expand Down
5 changes: 0 additions & 5 deletions io/zenoh-transport/src/unicast/lowlatency/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,7 @@ impl TransportUnicastLowlatency {
// to avoid concurrent new_transport and closing/closed notifications
let mut a_guard = self.get_alive().await;
*a_guard = false;

// Notify the callback that we are going to close the transport
let callback = zwrite!(self.callback).take();
if let Some(cb) = callback.as_ref() {
cb.closing();
}

// Delete the transport on the manager
let _ = self.manager.del_transport_unicast(&self.config.zid).await;
Expand Down
5 changes: 0 additions & 5 deletions io/zenoh-transport/src/unicast/universal/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,7 @@ impl TransportUnicastUniversal {
// to avoid concurrent new_transport and closing/closed notifications
let mut a_guard = self.get_alive().await;
*a_guard = false;

// Notify the callback that we are going to close the transport
let callback = zwrite!(self.callback).take();
if let Some(cb) = callback.as_ref() {
cb.closing();
}

// Delete the transport on the manager
let _ = self.manager.del_transport_unicast(&self.config.zid).await;
Expand Down
1 change: 0 additions & 1 deletion io/zenoh-transport/tests/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ impl TransportPeerEventHandler for SC {
}
fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
2 changes: 0 additions & 2 deletions io/zenoh-transport/tests/multicast_compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ mod tests {
count: self.count.clone(),
}))
}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand All @@ -127,7 +126,6 @@ mod tests {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
2 changes: 0 additions & 2 deletions io/zenoh-transport/tests/multicast_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ mod tests {
count: self.count.clone(),
}))
}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand All @@ -126,7 +125,6 @@ mod tests {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
1 change: 0 additions & 1 deletion io/zenoh-transport/tests/transport_whitelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ impl TransportPeerEventHandler for SCRouter {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
1 change: 0 additions & 1 deletion io/zenoh-transport/tests/unicast_authenticator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ impl TransportPeerEventHandler for MHRouterAuthenticator {
}
fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
2 changes: 0 additions & 2 deletions io/zenoh-transport/tests/unicast_compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ mod tests {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down Expand Up @@ -150,7 +149,6 @@ mod tests {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
1 change: 0 additions & 1 deletion io/zenoh-transport/tests/unicast_concurrent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ impl TransportPeerEventHandler for MHPeer {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
1 change: 0 additions & 1 deletion io/zenoh-transport/tests/unicast_intermittent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ impl TransportPeerEventHandler for SCClient {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
2 changes: 0 additions & 2 deletions io/zenoh-transport/tests/unicast_priorities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ impl TransportPeerEventHandler for SCRouter {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down Expand Up @@ -183,7 +182,6 @@ impl TransportPeerEventHandler for SCClient {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
1 change: 0 additions & 1 deletion io/zenoh-transport/tests/unicast_shm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ mod tests {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
1 change: 0 additions & 1 deletion io/zenoh-transport/tests/unicast_simultaneous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ mod tests {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
2 changes: 0 additions & 2 deletions io/zenoh-transport/tests/unicast_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ impl TransportPeerEventHandler for SCRouter {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down Expand Up @@ -336,7 +335,6 @@ impl TransportPeerEventHandler for SCClient {

fn new_link(&self, _link: Link) {}
fn del_link(&self, _link: Link) {}
fn closing(&self) {}
fn closed(&self) {}

fn as_any(&self) -> &dyn Any {
Expand Down
4 changes: 0 additions & 4 deletions zenoh/src/api/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ impl TransportMulticastEventHandler for Handler {
}
}

fn closing(&self) {}

fn closed(&self) {}

fn as_any(&self) -> &dyn std::any::Any {
Expand Down Expand Up @@ -250,8 +248,6 @@ impl TransportPeerEventHandler for PeerHandler {
);
}

fn closing(&self) {}

fn closed(&self) {
let info = DataInfo {
kind: SampleKind::Delete,
Expand Down
2 changes: 0 additions & 2 deletions zenoh/src/net/primitives/demux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ impl TransportPeerEventHandler for DeMux {

fn del_link(&self, _link: Link) {}

fn closing(&self) {}

fn closed(&self) {
self.face.send_close();
}
Expand Down
8 changes: 2 additions & 6 deletions zenoh/src/net/primitives/mux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,7 @@ impl Primitives for Mux {
}
}

fn send_close(&self) {
// self.handler.closing().await;
}
fn send_close(&self) {}
}

impl EPrimitives for Mux {
Expand Down Expand Up @@ -530,9 +528,7 @@ impl Primitives for McastMux {
}
}

fn send_close(&self) {
// self.handler.closing().await;
}
fn send_close(&self) {}
}

impl EPrimitives for McastMux {
Expand Down
20 changes: 0 additions & 20 deletions zenoh/src/net/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,13 +457,6 @@ impl TransportPeerEventHandler for RuntimeSession {
}
}

fn closing(&self) {
self.main_handler.closing();
for handler in &self.slave_handlers {
handler.closing();
}
}

fn closed(&self) {
self.main_handler.closed();
Runtime::closed_session(self);
Expand Down Expand Up @@ -500,12 +493,6 @@ impl TransportMulticastEventHandler for RuntimeMulticastGroup {
}))
}

fn closing(&self) {
for handler in &self.slave_handlers {
handler.closed();
}
}

fn closed(&self) {
for handler in &self.slave_handlers {
handler.closed();
Expand Down Expand Up @@ -541,13 +528,6 @@ impl TransportPeerEventHandler for RuntimeMulticastSession {
}
}

fn closing(&self) {
self.main_handler.closing();
for handler in &self.slave_handlers {
handler.closing();
}
}

fn closed(&self) {
self.main_handler.closed();
for handler in &self.slave_handlers {
Expand Down

0 comments on commit 512a372

Please sign in to comment.