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

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

Issue 217573002: make SetReceiveBufferSize and SetSendBufferSize return net error codes (instead of bools) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo on Linux 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_tcp.h" 5 #include "content/browser/renderer_host/p2p/socket_host_tcp.h"
6 6
7 #include "base/sys_byteorder.h" 7 #include "base/sys_byteorder.h"
8 #include "content/common/p2p_messages.h" 8 #include "content/common/p2p_messages.h"
9 #include "ipc/ipc_sender.h" 9 #include "ipc/ipc_sender.h"
10 #include "jingle/glue/fake_ssl_client_socket.h" 10 #include "jingle/glue/fake_ssl_client_socket.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 if (pos && pos <= read_buffer_->offset()) { 405 if (pos && pos <= read_buffer_->offset()) {
406 memmove(head, head + pos, read_buffer_->offset() - pos); 406 memmove(head, head + pos, read_buffer_->offset() - pos);
407 read_buffer_->set_offset(read_buffer_->offset() - pos); 407 read_buffer_->set_offset(read_buffer_->offset() - pos);
408 } 408 }
409 } 409 }
410 410
411 bool P2PSocketHostTcpBase::SetOption(P2PSocketOption option, int value) { 411 bool P2PSocketHostTcpBase::SetOption(P2PSocketOption option, int value) {
412 DCHECK_EQ(STATE_OPEN, state_); 412 DCHECK_EQ(STATE_OPEN, state_);
413 switch (option) { 413 switch (option) {
414 case P2P_SOCKET_OPT_RCVBUF: 414 case P2P_SOCKET_OPT_RCVBUF:
415 return socket_->SetReceiveBufferSize(value); 415 return socket_->SetReceiveBufferSize(value) == net::OK;
416 case P2P_SOCKET_OPT_SNDBUF: 416 case P2P_SOCKET_OPT_SNDBUF:
417 return socket_->SetSendBufferSize(value); 417 return socket_->SetSendBufferSize(value) == net::OK;
418 case P2P_SOCKET_OPT_DSCP: 418 case P2P_SOCKET_OPT_DSCP:
419 return false; // For TCP sockets DSCP setting is not available. 419 return false; // For TCP sockets DSCP setting is not available.
420 default: 420 default:
421 NOTREACHED(); 421 NOTREACHED();
422 return false; 422 return false;
423 } 423 }
424 } 424 }
425 425
426 P2PSocketHostTcp::P2PSocketHostTcp( 426 P2PSocketHostTcp::P2PSocketHostTcp(
427 IPC::Sender* message_sender, int id, 427 IPC::Sender* message_sender, int id,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } else { 558 } else {
559 packet_size += kTurnChannelDataHeaderSize; 559 packet_size += kTurnChannelDataHeaderSize;
560 // Calculate any padding if present. 560 // Calculate any padding if present.
561 if (packet_size % 4) 561 if (packet_size % 4)
562 *pad_bytes = 4 - packet_size % 4; 562 *pad_bytes = 4 - packet_size % 4;
563 } 563 }
564 return packet_size; 564 return packet_size;
565 } 565 }
566 566
567 } // namespace content 567 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698