This PR is on top of #377 to avoid merge conflicts. Will rebase this branch on #377 is merged.
This fixes 2 crashes:
After nominate a candidate, all TCP connections that does not belongs to nominated ICE are going to be deleted. The crash happen due to a race between deletion (which the endpoint is removed from IceSession before erased on std::vector) with a STUN request that was already enqueued on jobQueue that will re-add the endpoint again on IceSession. Although the delete takes some time because it has to terminate the socket, the endpoint pointer on IceSession will became dangling sooner or later and it will crash if we try to access it. Ensuring that we will not call the IceSession if the endpoint already does not belongs to the TransportImpl does not fix the issue (although it could became much less probable). We need to ensure we don't have any enqueued job for that endpoint so stop has to be made by Transport instead of being delegate to the destructor so we can have the state synced.
The 2nd crash is less problematic as it happens only when we are terminating the SMB. We need to stop httpd first so we ensure we don't have http requests trying to access resources that were already deleted
This PR is on top of #377 to avoid merge conflicts. Will rebase this branch on #377 is merged.
This fixes 2 crashes:
After nominate a candidate, all TCP connections that does not belongs to nominated ICE are going to be deleted. The crash happen due to a race between deletion (which the endpoint is removed from
IceSession
before erased on std::vector) with a STUN request that was already enqueued on jobQueue that will re-add the endpoint again onIceSession
. Although the delete takes some time because it has to terminate the socket, the endpoint pointer onIceSession
will became dangling sooner or later and it will crash if we try to access it. Ensuring that we will not call theIceSession
if the endpoint already does not belongs to the TransportImpl does not fix the issue (although it could became much less probable). We need to ensure we don't have any enqueued job for that endpoint sostop
has to be made by Transport instead of being delegate to the destructor so we can have the state synced.The 2nd crash is less problematic as it happens only when we are terminating the SMB. We need to stop httpd first so we ensure we don't have http requests trying to access resources that were already deleted