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

Unified Diff: net/socket/tcp_socket_libevent.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, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/socket/tcp_socket_libevent.cc
diff --git a/net/socket/tcp_socket_libevent.cc b/net/socket/tcp_socket_libevent.cc
index a7022fd85745bbe57ba1127d66530a141964c428..72ae5809e106c6ba37c1f061d93d96e255c7dfb7 100644
--- a/net/socket/tcp_socket_libevent.cc
+++ b/net/socket/tcp_socket_libevent.cc
@@ -501,22 +501,18 @@ int TCPSocketLibevent::SetAddressReuse(bool allow) {
return OK;
}
-bool TCPSocketLibevent::SetReceiveBufferSize(int32 size) {
+int TCPSocketLibevent::SetReceiveBufferSize(int32 size) {
DCHECK(CalledOnValidThread());
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;
+ reinterpret_cast<const char*>(&size), sizeof(size));
+ return (rv == 0) ? OK : MapSystemError(errno);
Ryan Hamilton 2014/04/08 19:55:11 please DCHECK_NE(0, errno)
jar (doing other things) 2014/04/08 23:16:26 Per discussion... I put in a local method to handl
}
-bool TCPSocketLibevent::SetSendBufferSize(int32 size) {
+int TCPSocketLibevent::SetSendBufferSize(int32 size) {
DCHECK(CalledOnValidThread());
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;
+ reinterpret_cast<const char*>(&size), sizeof(size));
+ return (rv == 0) ? OK : MapSystemError(errno);
Ryan Hamilton 2014/04/08 19:55:11 please DCHECK_NE(0, errno)
jar (doing other things) 2014/04/08 23:16:26 handled as above.
}
bool TCPSocketLibevent::SetKeepAlive(bool enable, int delay) {

Powered by Google App Engine
This is Rietveld 408576698