summaryrefslogtreecommitdiffstats
path: root/net/socket/tcp_client_socket_libevent.cc
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-09 22:38:04 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-09 22:38:04 +0000
commitd3f665783018ad6832b224d108640a0be2b1f248 (patch)
tree6634df109ace1c2df58fccf8ff4d9569ec3a5cd9 /net/socket/tcp_client_socket_libevent.cc
parent87fce2b91c8fa1f10ec49e79c719159097a597c5 (diff)
downloadchromium_src-d3f665783018ad6832b224d108640a0be2b1f248.zip
chromium_src-d3f665783018ad6832b224d108640a0be2b1f248.tar.gz
chromium_src-d3f665783018ad6832b224d108640a0be2b1f248.tar.bz2
Add methods for setting socket buffers to the Socket
class. Also add a few stats counters for TCP read/write stats. BUG=none TEST=none Review URL: http://codereview.chromium.org/199048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25803 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_client_socket_libevent.cc')
-rw-r--r--net/socket/tcp_client_socket_libevent.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index f417f80..8ad5ef3 100644
--- a/net/socket/tcp_client_socket_libevent.cc
+++ b/net/socket/tcp_client_socket_libevent.cc
@@ -262,6 +262,23 @@ int TCPClientSocketLibevent::Write(IOBuffer* buf,
return ERR_IO_PENDING;
}
+bool TCPClientSocketLibevent::SetReceiveBufferSize(int32 size) {
+ int rv = setsockopt(socket_, SOL_SOCKET, SO_RCVBUF,
+ reinterpret_cast<const char*>(&size),
+ sizeof(size));
+ DCHECK(!rv) << "Could not set socket receive buffer size: " << errno;
+ return rv == 0;
+}
+
+bool TCPClientSocketLibevent::SetSendBufferSize(int32 size) {
+ int rv = setsockopt(socket_, SOL_SOCKET, SO_SNDBUF,
+ reinterpret_cast<const char*>(&size),
+ sizeof(size));
+ DCHECK(!rv) << "Could not set socket send buffer size: " << errno;
+ return rv == 0;
+}
+
+
int TCPClientSocketLibevent::CreateSocket(const addrinfo* ai) {
socket_ = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (socket_ == kInvalidSocket)