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

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

Issue 2834083002: Fixing SignalSentPacket for TCP connections. (Closed)
Patch Set: Don't crash if socket wasn't created successfully. Created 3 years, 8 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
« no previous file with comments | « no previous file | webrtc/p2p/base/tcpport_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/tcpport.cc
diff --git a/webrtc/p2p/base/tcpport.cc b/webrtc/p2p/base/tcpport.cc
index 209f569f5c4301ae3edcc754bdfb95255d4b2459..79843d82de729eba851360513815e0334a5b7c99 100644
--- a/webrtc/p2p/base/tcpport.cc
+++ b/webrtc/p2p/base/tcpport.cc
@@ -157,10 +157,19 @@ Connection* TCPPort::CreateConnection(const Candidate& address,
TCPConnection* conn = NULL;
if (rtc::AsyncPacketSocket* socket =
GetIncoming(address.address(), true)) {
+ // Incoming connection; we already created a socket and connected signals,
+ // so we need to hand off the "read packet" responsibility to
+ // TCPConnection.
socket->SignalReadPacket.disconnect(this);
conn = new TCPConnection(this, address, socket);
} else {
+ // Outgoing connection, which will create a new socket for which we still
+ // need to connect SignalReadyToSend and SignalSentPacket.
conn = new TCPConnection(this, address);
+ if (conn->socket()) {
+ conn->socket()->SignalReadyToSend.connect(this, &TCPPort::OnReadyToSend);
+ conn->socket()->SignalSentPacket.connect(this, &TCPPort::OnSentPacket);
+ }
}
AddOrReplaceConnection(conn);
return conn;
« no previous file with comments | « no previous file | webrtc/p2p/base/tcpport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698