]> 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:25 +0000 (15:07 +0000)
commit6763dda90fb8faa0ac03a65f23dcf4be54a246ef
tree01a9023b2d53d9c1c692386b5bfa2b32bd67ebe6
parent3b2bde6c4842455eac4619438431c8de314b09cd
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