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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_udp.cc

Issue 227473008: make SetReceiveBufferSize and SetSendBufferSize return net error codes (instead of bools) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux typo Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/p2p/socket_host_throttler.h" 10 #include "content/browser/renderer_host/p2p/socket_host_throttler.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 DCHECK_EQ(state_, STATE_UNINITIALIZED); 88 DCHECK_EQ(state_, STATE_UNINITIALIZED);
89 89
90 int result = socket_->Listen(local_address); 90 int result = socket_->Listen(local_address);
91 if (result < 0) { 91 if (result < 0) {
92 LOG(ERROR) << "bind() failed: " << result; 92 LOG(ERROR) << "bind() failed: " << result;
93 OnError(); 93 OnError();
94 return false; 94 return false;
95 } 95 }
96 96
97 // Setting recv socket buffer size. 97 // Setting recv socket buffer size.
98 if (!socket_->SetReceiveBufferSize(kRecvSocketBufferSize)) { 98 if (socket_->SetReceiveBufferSize(kRecvSocketBufferSize) != net::OK) {
99 LOG(WARNING) << "Failed to set socket receive buffer size to " 99 LOG(WARNING) << "Failed to set socket receive buffer size to "
100 << kRecvSocketBufferSize; 100 << kRecvSocketBufferSize;
101 } 101 }
102 102
103 net::IPEndPoint address; 103 net::IPEndPoint address;
104 result = socket_->GetLocalAddress(&address); 104 result = socket_->GetLocalAddress(&address);
105 if (result < 0) { 105 if (result < 0) {
106 LOG(ERROR) << "P2PSocketHostUdp::Init(): unable to get local address: " 106 LOG(ERROR) << "P2PSocketHostUdp::Init(): unable to get local address: "
107 << result; 107 << result;
108 OnError(); 108 OnError();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 const net::IPEndPoint& remote_address, int id) { 295 const net::IPEndPoint& remote_address, int id) {
296 NOTREACHED(); 296 NOTREACHED();
297 OnError(); 297 OnError();
298 return NULL; 298 return NULL;
299 } 299 }
300 300
301 bool P2PSocketHostUdp::SetOption(P2PSocketOption option, int value) { 301 bool P2PSocketHostUdp::SetOption(P2PSocketOption option, int value) {
302 DCHECK_EQ(STATE_OPEN, state_); 302 DCHECK_EQ(STATE_OPEN, state_);
303 switch (option) { 303 switch (option) {
304 case P2P_SOCKET_OPT_RCVBUF: 304 case P2P_SOCKET_OPT_RCVBUF:
305 return socket_->SetReceiveBufferSize(value); 305 return socket_->SetReceiveBufferSize(value) == net::OK;
306 case P2P_SOCKET_OPT_SNDBUF: 306 case P2P_SOCKET_OPT_SNDBUF:
307 return socket_->SetSendBufferSize(value); 307 return socket_->SetSendBufferSize(value) == net::OK;
308 case P2P_SOCKET_OPT_DSCP: 308 case P2P_SOCKET_OPT_DSCP:
309 return (net::OK == socket_->SetDiffServCodePoint( 309 return (net::OK == socket_->SetDiffServCodePoint(
310 static_cast<net::DiffServCodePoint>(value))) ? true : false; 310 static_cast<net::DiffServCodePoint>(value))) ? true : false;
311 default: 311 default:
312 NOTREACHED(); 312 NOTREACHED();
313 return false; 313 return false;
314 } 314 }
315 } 315 }
316 316
317 } // namespace content 317 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698