From 95a32ec098b90695f309f5cbdb41f2eb489a9434 Mon Sep 17 00:00:00 2001 From: "bjornv@webrtc.org" Date: Sat, 7 Feb 2015 06:46:56 +0000 Subject: [PATCH] Revert 8271 "VirtualSocketServer out-of-order issue with closing..." Failed on Linux_Memcheck bot. http://chromegw/i/client.webrtc/builders/Linux%20Memcheck/builds/3182 > 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 TBR=pthatcher@webrtc.org Review URL: https://webrtc-codereview.appspot.com/38979004 Cr-Commit-Position: refs/heads/master@{#8280} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8280 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/base/virtualsocketserver.cc | 4 +--- webrtc/p2p/base/turnport_unittest.cc | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/webrtc/base/virtualsocketserver.cc b/webrtc/base/virtualsocketserver.cc index 35e6579eb4..59587bb845 100644 --- a/webrtc/base/virtualsocketserver.cc +++ b/webrtc/base/virtualsocketserver.cc @@ -723,9 +723,7 @@ int VirtualSocketServer::Connect(VirtualSocket* socket, bool VirtualSocketServer::Disconnect(VirtualSocket* socket) { if (socket) { // Remove the mapping. - // Posted at network_delay_ + 1 so it is scheduled after any - // pending packets. - msg_queue_->PostAt(network_delay_ + 1, socket, MSG_ID_DISCONNECT); + msg_queue_->Post(socket, MSG_ID_DISCONNECT); return true; } return false; diff --git a/webrtc/p2p/base/turnport_unittest.cc b/webrtc/p2p/base/turnport_unittest.cc index 224521d3b5..da2c6b94ac 100644 --- a/webrtc/p2p/base/turnport_unittest.cc +++ b/webrtc/p2p/base/turnport_unittest.cc @@ -771,7 +771,7 @@ TEST_F(TurnPortTest, TestTurnReleaseAllocation) { } // Test that a TURN TCP allocation is released when the port is closed. -TEST_F(TurnPortTest, TestTurnTCPReleaseAllocation) { +TEST_F(TurnPortTest, DISABLED_TestTurnTCPReleaseAllocation) { turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP); CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr); turn_port_->PrepareAddress();