Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1044)

Unified Diff: webrtc/p2p/base/turnport_unittest.cc

Issue 1247573002: Fix a Turn TCP port issue. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Slight change in asynctcpsocket.cc Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webrtc/p2p/base/turnport.cc ('K') | « webrtc/p2p/base/turnport.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/turnport_unittest.cc
diff --git a/webrtc/p2p/base/turnport_unittest.cc b/webrtc/p2p/base/turnport_unittest.cc
index 3172ba252f2930156792fa57049d31c460f5c045..410eb9917d08cabae48d1e76e976325780a85072 100644
--- a/webrtc/p2p/base/turnport_unittest.cc
+++ b/webrtc/p2p/base/turnport_unittest.cc
@@ -490,6 +490,25 @@ TEST_F(TurnPortTest, TestTurnTcpAllocate) {
EXPECT_NE(0, turn_port_->Candidates()[0].address().port());
}
+// Test that sending a TurnAllocate will fail if the TCP connection is closed.
+TEST_F(TurnPortTest, TestSendingAllocateWhenSocketClosed) {
+ turn_server_.AddInternalSocket(kTurnTcpIntAddr, cricket::PROTO_TCP);
+ CreateTurnPort(kTurnUsername, kTurnPassword, kTurnTcpProtoAddr);
+ EXPECT_EQ(0, turn_port_->SetOption(rtc::Socket::OPT_SNDBUF, 10 * 1024));
+ turn_port_->PrepareAddress();
+ turn_ready_ = false;
+ turn_port_->SendAllocateRequest(0);
+ EXPECT_TRUE_WAIT(turn_ready_, kTimeout);
+
+ // Close the socket and send the request again.
+ turn_ready_ = false;
+ turn_port_->OnSocketClose(turn_port_->socket(), 1);
+ turn_port_->SendAllocateRequest(0);
+ // Wait for half a second and check.
+ WAIT(false, kTimeout / 2);
+ EXPECT_FALSE(turn_ready_);
+}
+
// Test case for WebRTC issue 3927 where a proxy binds to the local host address
// instead the address that TurnPort originally bound to. The candidate pair
// impacted by this behavior should still be used.
« webrtc/p2p/base/turnport.cc ('K') | « webrtc/p2p/base/turnport.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698