VirtualSocketServer out-of-order issue with closing TCP sockets
https://webrtc-codereview.appspot.com/41449004 added a TURN TCP allocation release test which was disabled as it triggered an assert in the turnserver. This was caused by VirtualSockerServer delivering the last TCP packet after closing the connection. Calling VirtualSocketServer::SendTcp and VirtualSocket::Close from TestTurnTCPReleaseAllocation led to the following order of messages in VirtualSocket::OnMessage: MSG_ID_DISCONNECT MSG_ID_PACKET This is out of order and triggers an assert in turnserver.cc since the socket from which the message arrives has already been discarded, subsequently breaking the test. In VirtualSocketServer::Disconnect the MSG_ID_DISCONNECT is posted to the msg_queue immediately, thus getting ahead of any (slightly delayed) actual packets. Maybe PostAt(network_delay_ + 1, ...) would be better? Re-enables TestTurnTCPReleaseAllocation. BUG= R=juberti@webrtc.org Review URL: https://webrtc-codereview.appspot.com/34759004 Cr-Commit-Position: refs/heads/master@{#8271} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8271 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
9baa9ca399
commit
4770437da9
@ -723,7 +723,9 @@ int VirtualSocketServer::Connect(VirtualSocket* socket,
|
||||
bool VirtualSocketServer::Disconnect(VirtualSocket* socket) {
|
||||
if (socket) {
|
||||
// Remove the mapping.
|
||||
msg_queue_->Post(socket, MSG_ID_DISCONNECT);
|
||||
// Posted at network_delay_ + 1 so it is scheduled after any
|
||||
// pending packets.
|
||||
msg_queue_->PostAt(network_delay_ + 1, socket, MSG_ID_DISCONNECT);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -771,7 +771,7 @@ TEST_F(TurnPortTest, TestTurnReleaseAllocation) {
|
||||
}
|
||||
|
||||
// Test that a TURN TCP allocation is released when the port is closed.
|
||||
TEST_F(TurnPortTest, DISABLED_TestTurnTCPReleaseAllocation) {
|
||||
TEST_F(TurnPortTest, TestTurnTCPReleaseAllocation) {
|
||||
turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP);
|
||||
CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
|
||||
turn_port_->PrepareAddress();
|
||||
|
Loading…
x
Reference in New Issue
Block a user