[sr-dev] patch porposal for usrloc: close TCP connections

Camille Oudot camille.oudot at orange.com
Mon Mar 23 16:48:17 CET 2015


Le Mon, 23 Mar 2015 17:31:33 +0200,
Vitaliy Aleksandrov <vitalik.voip at gmail.com> a écrit :

> 
> Hi,
> 
> I have a feeling that this patch creates a big opportunity for
> closing wrong connections.
> Lets imagine the situation when you have a contact with the
> tcpconn_id=X and this contact wasn't refreshed by a UA in time. When
> proposed option is enabled kamailio will close a connection with ID =
> X at the next timer run. But we have no guarantee that ID = X is
> still identifies connection we want to close because this connection
> could be closed before timer run and then its ID reused by another
> client.

The way the id is attributed make it unique by kamailio instance. The
id is just a counter that is incremented for every new connection, so
what you described will not happen.

in tcpmain.c, tcpconn_new():

	c->id=(*connection_id)++

What bothers me is what happens when an instance will have served
INT_MAX connections (typically ~2.1 billions). But when it happens, I
will be happy :).

Cheers

-- 
Camille



More information about the sr-dev mailing list