Opened 9 years ago

Last modified 6 years ago

#1840 new defect

Review API pjsua_transport_close()

Reported by: nanang Owned by: bennylp
Priority: normal Milestone: release-2.10
Component: pjsua-lib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no


This API is mainly used for shutting down the transport *listener*, while SIP endpoint applications usually don't need to shutdown a listener, especially if it uses a SIP proxy and/or behind NAT, as it won't need to accept incoming TCP/TLS connection (the connection is always initiated by the endpoint).

Currently, there is a known flaw with this API:

  • if 'force' is specified, it is unsafe:
     * Close the transport. If transport is forcefully closed, it will be
     * immediately closed, and any pending transactions that are using the
     * transport may not terminate properly (it may even crash). Otherwise, 
     * the system will wait until all transactions are closed while preventing 
     * new users from using the transport, and will close the transport when 
     * it is safe to do so.
  • otherwise, it will leak PJSUA transport descriptor, i.e: pjsua_var.tpdata:
     * If force is not specified, transports will be closed at their
     * convenient time. However this will leak PJSUA-API transport
     * descriptors as PJSUA-API wouldn't know when exactly the
     * transport is closed thus it can't cleanup PJSUA transport
     * descriptor.

This ticket will review whether the leak issue could be resolved, and in case it couldn't (or perhaps requiring major changes), perhaps we should consider to deprecate the API.

Change History (1)

comment:1 Changed 6 years ago by riza

  • Milestone changed from Known-Issues-and-Ideas to release-2.9

TeluuCon? 2018: need to deprecate this API

Note: See TracTickets for help on using tickets.