]> 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)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 14 Nov 2024 20:01:34 +0000 (20:01 +0000)
commit9374ae10364954365fe99078736b92e7483507e3
tree6371eed1ef7939b4c3b085241b4421e6dd557e54
parentfc8c518709cd346c36bd6634a0fb93f72197cb19
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
(cherry picked from commit 6763dda90fb8faa0ac03a65f23dcf4be54a246ef)
res/res_pjsip/pjsip_transport_events.c
res/res_pjsip_outbound_registration.c