diff options
| author | zy <[email protected]> | 2023-10-26 10:10:41 +0000 |
|---|---|---|
| committer | zy <[email protected]> | 2023-10-26 10:10:41 +0000 |
| commit | ab450462c67ccfb073c9db6629f1d9b056d0cb7c (patch) | |
| tree | 3cefbe4ea605625682ddb8ee77b784f32fcac244 | |
| parent | 326dfdc60113af776c418042c7b56a4cbf31310d (diff) | |
add Drop for ExamplePulgin
| -rw-r--r-- | src/plugin/example.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugin/example.rs b/src/plugin/example.rs index a8b5e44..f6a28eb 100644 --- a/src/plugin/example.rs +++ b/src/plugin/example.rs @@ -51,7 +51,7 @@ impl PHandle<()> for ExamplePulgin { packet: Option<&'a crate::packet::packet::Packet<'a>>, // packet as a reference, need 'a lifetime session: Option<Rc<RefCell<Session>>>, events: LinkedList<Event>, - ) -> () { + ) { let bind = session.unwrap(); let mut session = bind.try_borrow_mut().unwrap(); session.inc_session_c2s_metrics(0, 0, 1, 1); @@ -94,3 +94,9 @@ impl PHandle<()> for ExamplePulgin { } } } + +impl Drop for ExamplePulgin { + fn drop(&mut self) { + self.plug_events.unregister() + } +} |
