summaryrefslogtreecommitdiff
path: root/src/plugin/example.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugin/example.rs')
-rw-r--r--src/plugin/example.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/plugin/example.rs b/src/plugin/example.rs
index 6819d75..bce1724 100644
--- a/src/plugin/example.rs
+++ b/src/plugin/example.rs
@@ -78,19 +78,19 @@ impl EventHandle for ExamplePulgin {
packet: Option<&Packet>,
session: Option<Rc<RefCell<Session>>>,
) {
+ self.plugin_ctx.borrow_mut().clear();
+ self.plugin_ctx.borrow_mut().push_str("1");
+
if session.is_none() {
return;
}
- let length = packet.unwrap().orig_len;
- let flow_id = packet.unwrap().get_flow_id();
- println!(
- "{} handle Packet: {:?} {:?}",
- self.plugin_name, length, flow_id
- );
-
- self.plugin_ctx.borrow_mut().clear();
- self.plugin_ctx.borrow_mut().push_str("1");
+ if packet.is_some() {
+ let flow_id = packet.unwrap().get_flow_id();
+ println!("{} handle Packet: {:?}", self.plugin_name, flow_id);
+ } else {
+ println!("{} handle Packet: None", self.plugin_name);
+ }
let session = session.unwrap();
if index == self.tcp_opening_event {