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

Side by Side Diff: trunk/src/net/socket/tcp_socket_libevent.cc

Issue 227083002: Revert 261966 "make SetReceiveBufferSize and SetSendBufferSize r..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
« no previous file with comments | « trunk/src/net/socket/tcp_socket_libevent.h ('k') | trunk/src/net/socket/tcp_socket_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "net/socket/tcp_socket.h" 5 #include "net/socket/tcp_socket.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <netdb.h> 9 #include <netdb.h>
10 #include <netinet/in.h> 10 #include <netinet/in.h>
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 // 494 //
495 // SO_REUSEPORT is provided in MacOS X and iOS. 495 // SO_REUSEPORT is provided in MacOS X and iOS.
496 int boolean_value = allow ? 1 : 0; 496 int boolean_value = allow ? 1 : 0;
497 int rv = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, &boolean_value, 497 int rv = setsockopt(socket_, SOL_SOCKET, SO_REUSEADDR, &boolean_value,
498 sizeof(boolean_value)); 498 sizeof(boolean_value));
499 if (rv < 0) 499 if (rv < 0)
500 return MapSystemError(errno); 500 return MapSystemError(errno);
501 return OK; 501 return OK;
502 } 502 }
503 503
504 int TCPSocketLibevent::SetReceiveBufferSize(int32 size) { 504 bool TCPSocketLibevent::SetReceiveBufferSize(int32 size) {
505 DCHECK(CalledOnValidThread()); 505 DCHECK(CalledOnValidThread());
506 int rv = setsockopt(socket_, SOL_SOCKET, SO_RCVBUF, 506 int rv = setsockopt(socket_, SOL_SOCKET, SO_RCVBUF,
507 reinterpret_cast<const char*>(&size), sizeof(size)); 507 reinterpret_cast<const char*>(&size),
508 return (rv == 0) ? OK : MapSystemError(errno); 508 sizeof(size));
509 DCHECK(!rv) << "Could not set socket receive buffer size: " << errno;
510 return rv == 0;
509 } 511 }
510 512
511 int TCPSocketLibevent::SetSendBufferSize(int32 size) { 513 bool TCPSocketLibevent::SetSendBufferSize(int32 size) {
512 DCHECK(CalledOnValidThread()); 514 DCHECK(CalledOnValidThread());
513 int rv = setsockopt(socket_, SOL_SOCKET, SO_SNDBUF, 515 int rv = setsockopt(socket_, SOL_SOCKET, SO_SNDBUF,
514 reinterpret_cast<const char*>(&size), sizeof(size)); 516 reinterpret_cast<const char*>(&size),
515 return (rv == 0) ? OK : MapSystemError(errno); 517 sizeof(size));
518 DCHECK(!rv) << "Could not set socket send buffer size: " << errno;
519 return rv == 0;
516 } 520 }
517 521
518 bool TCPSocketLibevent::SetKeepAlive(bool enable, int delay) { 522 bool TCPSocketLibevent::SetKeepAlive(bool enable, int delay) {
519 DCHECK(CalledOnValidThread()); 523 DCHECK(CalledOnValidThread());
520 return SetTCPKeepAlive(socket_, enable, delay); 524 return SetTCPKeepAlive(socket_, enable, delay);
521 } 525 }
522 526
523 bool TCPSocketLibevent::SetNoDelay(bool no_delay) { 527 bool TCPSocketLibevent::SetNoDelay(bool no_delay) {
524 DCHECK(CalledOnValidThread()); 528 DCHECK(CalledOnValidThread());
525 return SetTCPNoDelay(socket_, no_delay); 529 return SetTCPNoDelay(socket_, no_delay);
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 } 897 }
894 } else { 898 } else {
895 fast_open_status_ = (fast_open_status_ == FAST_OPEN_FAST_CONNECT_RETURN ? 899 fast_open_status_ = (fast_open_status_ == FAST_OPEN_FAST_CONNECT_RETURN ?
896 FAST_OPEN_SYN_DATA_FAILED : 900 FAST_OPEN_SYN_DATA_FAILED :
897 FAST_OPEN_NO_SYN_DATA_FAILED); 901 FAST_OPEN_NO_SYN_DATA_FAILED);
898 } 902 }
899 } 903 }
900 } 904 }
901 905
902 } // namespace net 906 } // namespace net
OLDNEW
« no previous file with comments | « trunk/src/net/socket/tcp_socket_libevent.h ('k') | trunk/src/net/socket/tcp_socket_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698