asd.client_disco_state = APPID_DISCO_STATE_FINISHED;
asd.set_session_flags(APPID_SESSION_SERVICE_DETECTED);
- if (asd.tpsession and tp_appid_ctxt and
- (asd.tpsession->get_ctxt_version() == tp_appid_ctxt->get_version()))
+ if (asd.tpsession and asd.need_to_delete_tp_conn(tp_appid_ctxt))
asd.tpsession->reset();
else if (asd.tpsession)
asd.tpsession->set_state(TP_STATE_TERMINATED);
if (tpsession)
{
- if (pkt_thread_tp_appid_ctxt and
- ((tpsession->get_ctxt_version() == pkt_thread_tp_appid_ctxt->get_version()) and
- !ThirdPartyAppIdContext::get_tp_reload_in_progress()))
+ if (need_to_delete_tp_conn(pkt_thread_tp_appid_ctxt))
tpsession->delete_with_ctxt();
else
delete tpsession;
free_flow_data_by_mask(APPID_SESSION_DATA_CLIENT_MODSTATE_BIT);
//3rd party cleaning
- if (tpsession and curr_tp_appid_ctxt and
- (tpsession->get_ctxt_version() == curr_tp_appid_ctxt->get_version()))
+ if (tpsession and need_to_delete_tp_conn(curr_tp_appid_ctxt))
tpsession->reset();
else if (tpsession)
tpsession->set_state(TP_STATE_TERMINATED);
tp_payload_app_id = APP_ID_UNKNOWN;
tp_app_id = APP_ID_UNKNOWN;
- if (tpsession and pkt_thread_tp_appid_ctxt and
- (tpsession->get_ctxt_version() == pkt_thread_tp_appid_ctxt->get_version()))
+ if (tpsession and need_to_delete_tp_conn(pkt_thread_tp_appid_ctxt))
tpsession->reset();
else if (tpsession)
tpsession->set_state(TP_STATE_TERMINATED);
return true;
}
+bool AppIdSession::need_to_delete_tp_conn(ThirdPartyAppIdContext* curr_tp_appid_ctxt) const
+{
+ // do not delete a third-party connection when reload third-party is in progress, and
+ // third-party context swap isn't complete; since all open connections will be deleted
+ // as part of the third-party reload pruning process.
+ return (curr_tp_appid_ctxt and ((tpsession->get_ctxt_version() == curr_tp_appid_ctxt->get_version()) and
+ !ThirdPartyAppIdContext::get_tp_reload_in_progress()));
+}
+
void AppIdSession::set_tp_app_id(const Packet& p, AppidSessionDirection dir, AppId app_id,
AppidChangeBits& change_bits)
{
void publish_appid_event(AppidChangeBits&, const snort::Packet&, bool is_http2 = false,
uint32_t http2_stream_index = 0);
+ bool need_to_delete_tp_conn(ThirdPartyAppIdContext*) const;
+
inline void set_tp_app_id(AppId app_id)
{
if (tp_app_id != app_id)
void AppIdSession::update_encrypted_app_id(AppId) {}
bool AppIdSession::is_tp_processing_done() const {return false;}
AppId AppIdSession::pick_ss_payload_app_id(AppId) const { return get_payload_id(); }
+bool AppIdSession::need_to_delete_tp_conn(ThirdPartyAppIdContext*) const { return true; }
AppIdSession* AppIdSession::allocate_session(const Packet*, IpProtocol,
AppidSessionDirection, AppIdInspector&, OdpContext&)
{