fix: make sure rx_pkt_cnt & tx_pkt_cnt both always exist

This commit is contained in:
Toby 2024-03-30 14:30:20 -07:00
parent ecd60d0ff1
commit e535769086

View File

@ -206,8 +206,8 @@ func (o *openvpnUDPStream) Feed(rev bool, data []byte) (u *analyzer.PropUpdate,
cancelled, o.respDone = o.respLSM.Run() cancelled, o.respDone = o.respLSM.Run()
if o.respUpdated { if o.respUpdated {
update = &analyzer.PropUpdate{ update = &analyzer.PropUpdate{
Type: analyzer.PropUpdateMerge, Type: analyzer.PropUpdateReplace,
M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt}, M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt, "tx_pkt_cnt": o.txPktCnt},
} }
o.respUpdated = false o.respUpdated = false
} }
@ -216,8 +216,8 @@ func (o *openvpnUDPStream) Feed(rev bool, data []byte) (u *analyzer.PropUpdate,
cancelled, o.reqDone = o.reqLSM.Run() cancelled, o.reqDone = o.reqLSM.Run()
if o.reqUpdated { if o.reqUpdated {
update = &analyzer.PropUpdate{ update = &analyzer.PropUpdate{
Type: analyzer.PropUpdateMerge, Type: analyzer.PropUpdateReplace,
M: analyzer.PropMap{"tx_pkt_cnt": o.txPktCnt}, M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt, "tx_pkt_cnt": o.txPktCnt},
} }
o.reqUpdated = false o.reqUpdated = false
} }
@ -296,8 +296,8 @@ func (o *openvpnTCPStream) Feed(rev, start, end bool, skip int, data []byte) (u
cancelled, o.respDone = o.respLSM.Run() cancelled, o.respDone = o.respLSM.Run()
if o.respUpdated { if o.respUpdated {
update = &analyzer.PropUpdate{ update = &analyzer.PropUpdate{
Type: analyzer.PropUpdateMerge, Type: analyzer.PropUpdateReplace,
M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt}, M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt, "tx_pkt_cnt": o.txPktCnt},
} }
o.respUpdated = false o.respUpdated = false
} }
@ -308,7 +308,7 @@ func (o *openvpnTCPStream) Feed(rev, start, end bool, skip int, data []byte) (u
if o.reqUpdated { if o.reqUpdated {
update = &analyzer.PropUpdate{ update = &analyzer.PropUpdate{
Type: analyzer.PropUpdateMerge, Type: analyzer.PropUpdateMerge,
M: analyzer.PropMap{"tx_pkt_cnt": o.txPktCnt}, M: analyzer.PropMap{"rx_pkt_cnt": o.rxPktCnt, "tx_pkt_cnt": o.txPktCnt},
} }
o.reqUpdated = false o.reqUpdated = false
} }