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

Unified Diff: content/browser/renderer_host/p2p/socket_host_tcp.cc

Issue 691253003: Avoid calling P2PSocketHostTcpBase::DoRead in case of error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « content/browser/renderer_host/p2p/socket_host_tcp.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/p2p/socket_host_tcp.cc
diff --git a/content/browser/renderer_host/p2p/socket_host_tcp.cc b/content/browser/renderer_host/p2p/socket_host_tcp.cc
index d2f2711409018d7f579eb473a4279601f98330ab..0ca2655764731efe2f2673202f2e670ba5176b47 100644
--- a/content/browser/renderer_host/p2p/socket_host_tcp.cc
+++ b/content/browser/renderer_host/p2p/socket_host_tcp.cc
@@ -234,11 +234,14 @@ void P2PSocketHostTcpBase::OnOpen() {
<< kSendSocketBufferSize;
}
- DoSendSocketCreateMsg();
+ if (!DoSendSocketCreateMsg())
+ return;
+
+ DCHECK_EQ(state_, STATE_OPEN);
DoRead();
}
-void P2PSocketHostTcpBase::DoSendSocketCreateMsg() {
+bool P2PSocketHostTcpBase::DoSendSocketCreateMsg() {
DCHECK(socket_.get());
net::IPEndPoint local_address;
@@ -247,7 +250,7 @@ void P2PSocketHostTcpBase::DoSendSocketCreateMsg() {
LOG(ERROR) << "P2PSocketHostTcpBase::OnConnected: unable to get local"
<< " address: " << result;
OnError();
- return;
+ return false;
}
VLOG(1) << "Local address: " << local_address.ToString();
@@ -258,7 +261,7 @@ void P2PSocketHostTcpBase::DoSendSocketCreateMsg() {
LOG(ERROR) << "P2PSocketHostTcpBase::OnConnected: unable to get peer"
<< " address: " << result;
OnError();
- return;
+ return false;
}
VLOG(1) << "Remote address: " << remote_address.ToString();
if (remote_address_.ip_address.address().empty()) {
@@ -272,6 +275,7 @@ void P2PSocketHostTcpBase::DoSendSocketCreateMsg() {
// packets sent before that by the application.
message_sender_->Send(new P2PMsg_OnSocketCreated(
id_, local_address, remote_address));
+ return true;
}
void P2PSocketHostTcpBase::DoRead() {
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698