]> git.ipfire.org Git - thirdparty/asterisk.git/commit
pjsip_transport_events: Avoid monitor destruction
authorThomas Guebels <thomas.guebels@dstny.com>
Mon, 28 Oct 2024 16:29:48 +0000 (17:29 +0100)
committerThomas Guebels <thomas.guebels@dstny.com>
Mon, 4 Nov 2024 15:07:24 +0000 (15:07 +0000)
commit03e08d5c33c60b3e099feb322161bec85c157413
tree8afe999761e1b625ce4a007b9531bf41c1cbef6f
parent0cdf5a2bb9f83df9759e4a982e6cd59fe1c96820
pjsip_transport_events: Avoid monitor destruction

When a transport is disconnected, several events can arrive following
each other. The first event will be PJSIP_TP_STATE_DISCONNECT and it
will trigger the destruction of the transport monitor object. The lookup
for the transport monitor to destroy is done using the transport key,
that contains the transport destination host:port.

A reconnect attempt by pjsip will be triggered as soon something needs to
send a packet using that transport. This can happen directly after a
disconnect since ca

Subsequent events can arrive later like PJSIP_TP_STATE_DESTROY and will
also try to trigger the destruction of the transport monitor if not
already done. Since the lookup for the transport monitor to destroy is
done using the transport key, it can match newly created transports
towards the same destination and destroy their monitor object.

Because of this, it was sometimes not possible to monitor a transport
after one or more disconnections.

This fix adds an additional check on the transport pointer to ensure
only a monitor for that specific transport is removed.

Fixes: #923
res/res_pjsip/pjsip_transport_events.c
res/res_pjsip_outbound_registration.c