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

Unified Diff: net/udp/udp_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/udp/udp_socket_libevent.cc
diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc
index 564627631a823b8e6c5efd7c9885e789aa056603..7db3f96dd128fb1f6d8c61e951b37455f0349fe4 100644
--- a/net/udp/udp_socket_libevent.cc
+++ b/net/udp/udp_socket_libevent.cc
@@ -315,20 +315,22 @@ int UDPSocketLibevent::Bind(const IPEndPoint& address) {
return rv;
}
-bool UDPSocketLibevent::SetReceiveBufferSize(int32 size) {
+int UDPSocketLibevent::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;
+ int last_error = errno;
+ DCHECK(!rv) << "Could not set socket receive buffer size: " << last_error;
+ return rv == 0 ? OK : MapSystemError(last_error);
Ryan Hamilton 2014/04/08 19:55:11 one more here (errno == 0, potential gotcha)
jar (doing other things) 2014/04/08 23:16:26 Handled in common function.
}
-bool UDPSocketLibevent::SetSendBufferSize(int32 size) {
+int UDPSocketLibevent::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;
+ int last_error = errno;
+ DCHECK(!rv) << "Could not set socket send buffer size: " << last_error;
+ return rv == 0 ? OK : MapSystemError(last_error);
}
void UDPSocketLibevent::AllowAddressReuse() {

Powered by Google App Engine
This is Rietveld 408576698