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

Side by Side Diff: net/socket/tcp_socket_posix.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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
« no previous file with comments | « net/socket/tcp_socket_posix.h ('k') | net/socket/tcp_socket_unittest.cc » ('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 <netinet/tcp.h> 8 #include <netinet/tcp.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 10
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // 397 //
398 // SO_REUSEPORT is provided in MacOS X and iOS. 398 // SO_REUSEPORT is provided in MacOS X and iOS.
399 int boolean_value = allow ? 1 : 0; 399 int boolean_value = allow ? 1 : 0;
400 int rv = setsockopt(socket_->socket_fd(), SOL_SOCKET, SO_REUSEADDR, 400 int rv = setsockopt(socket_->socket_fd(), SOL_SOCKET, SO_REUSEADDR,
401 &boolean_value, sizeof(boolean_value)); 401 &boolean_value, sizeof(boolean_value));
402 if (rv < 0) 402 if (rv < 0)
403 return MapSystemError(errno); 403 return MapSystemError(errno);
404 return OK; 404 return OK;
405 } 405 }
406 406
407 int TCPSocketPosix::SetReceiveBufferSize(int32 size) { 407 int TCPSocketPosix::SetReceiveBufferSize(int32_t size) {
408 DCHECK(socket_); 408 DCHECK(socket_);
409 int rv = setsockopt(socket_->socket_fd(), SOL_SOCKET, SO_RCVBUF, 409 int rv = setsockopt(socket_->socket_fd(), SOL_SOCKET, SO_RCVBUF,
410 reinterpret_cast<const char*>(&size), sizeof(size)); 410 reinterpret_cast<const char*>(&size), sizeof(size));
411 return (rv == 0) ? OK : MapSystemError(errno); 411 return (rv == 0) ? OK : MapSystemError(errno);
412 } 412 }
413 413
414 int TCPSocketPosix::SetSendBufferSize(int32 size) { 414 int TCPSocketPosix::SetSendBufferSize(int32_t size) {
415 DCHECK(socket_); 415 DCHECK(socket_);
416 int rv = setsockopt(socket_->socket_fd(), SOL_SOCKET, SO_SNDBUF, 416 int rv = setsockopt(socket_->socket_fd(), SOL_SOCKET, SO_SNDBUF,
417 reinterpret_cast<const char*>(&size), sizeof(size)); 417 reinterpret_cast<const char*>(&size), sizeof(size));
418 return (rv == 0) ? OK : MapSystemError(errno); 418 return (rv == 0) ? OK : MapSystemError(errno);
419 } 419 }
420 420
421 bool TCPSocketPosix::SetKeepAlive(bool enable, int delay) { 421 bool TCPSocketPosix::SetKeepAlive(bool enable, int delay) {
422 DCHECK(socket_); 422 DCHECK(socket_);
423 return SetTCPKeepAlive(socket_->socket_fd(), enable, delay); 423 return SetTCPKeepAlive(socket_->socket_fd(), enable, delay);
424 } 424 }
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 if (info.tcpi_rtt > 0) { 763 if (info.tcpi_rtt > 0) {
764 *out_rtt = base::TimeDelta::FromMicroseconds(info.tcpi_rtt); 764 *out_rtt = base::TimeDelta::FromMicroseconds(info.tcpi_rtt);
765 return true; 765 return true;
766 } 766 }
767 } 767 }
768 #endif // defined(TCP_INFO) 768 #endif // defined(TCP_INFO)
769 return false; 769 return false;
770 } 770 }
771 771
772 } // namespace net 772 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_socket_posix.h ('k') | net/socket/tcp_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698