Commit 5f493360 authored by jschuh@chromium.org's avatar jschuh@chromium.org

Revert 261966 "make SetReceiveBufferSize and SetSendBufferSize r..."

Appears to have broken the following gcm_unit_tests on Mac:

DeviceCredentials
AckOnLogin
AckWhenLimitReachedWithHeartbeat
ExpiredTTLOnRestart
InitializeExisting
SendMessageRMQAckOnReconnect
SendMessageRMQOnRestart
SendMessageRMQPartialAckOnReconnect
SendMessageRMQWithStreamAck

http://build.chromium.org/p/chromium.mac/builders/Mac%2010.6%20Tests%20%28dbg%29%284%29/builds/39860


> make SetReceiveBufferSize and SetSendBufferSize return net error codes (instead of bools)
> 
> TBR=sergeyu,yzshen
> R=wtc
> BUG=355222
> 
> Review URL: https://codereview.chromium.org/217573002

TBR=jar@chromium.org

Review URL: https://codereview.chromium.org/227083002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262002 0039d316-1c4b-4281-b951-d872f2087c98
parent 228f013f
......@@ -137,14 +137,14 @@ int AndroidUsbSocket::Write(net::IOBuffer* buffer,
return net::ERR_IO_PENDING;
}
int AndroidUsbSocket::SetReceiveBufferSize(int32 size) {
bool AndroidUsbSocket::SetReceiveBufferSize(int32 size) {
NOTIMPLEMENTED();
return net::ERR_NOT_IMPLEMENTED;
return false;
}
int AndroidUsbSocket::SetSendBufferSize(int32 size) {
bool AndroidUsbSocket::SetSendBufferSize(int32 size) {
NOTIMPLEMENTED();
return net::ERR_NOT_IMPLEMENTED;
return false;
}
int AndroidUsbSocket::Connect(const net::CompletionCallback& callback) {
......@@ -180,7 +180,7 @@ int AndroidUsbSocket::GetPeerAddress(net::IPEndPoint* address) const {
int AndroidUsbSocket::GetLocalAddress(net::IPEndPoint* address) const {
NOTIMPLEMENTED();
return net::ERR_NOT_IMPLEMENTED;
return net::ERR_FAILED;
}
const net::BoundNetLog& AndroidUsbSocket::NetLog() const {
......
......@@ -38,8 +38,8 @@ class AndroidUsbSocket : public net::StreamSocket,
const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
virtual void Disconnect() OVERRIDE;
virtual bool IsConnected() const OVERRIDE;
......
......@@ -412,9 +412,9 @@ bool P2PSocketHostTcpBase::SetOption(P2PSocketOption option, int value) {
DCHECK_EQ(STATE_OPEN, state_);
switch (option) {
case P2P_SOCKET_OPT_RCVBUF:
return socket_->SetReceiveBufferSize(value) == net::OK;
return socket_->SetReceiveBufferSize(value);
case P2P_SOCKET_OPT_SNDBUF:
return socket_->SetSendBufferSize(value) == net::OK;
return socket_->SetSendBufferSize(value);
case P2P_SOCKET_OPT_DSCP:
return false; // For TCP sockets DSCP setting is not available.
default:
......
......@@ -103,14 +103,13 @@ void FakeSocket::DoAsyncWrite(scoped_refptr<net::IOBuffer> buf, int buf_len,
callback.Run(buf_len);
}
int FakeSocket::SetReceiveBufferSize(int32 size) {
bool FakeSocket::SetReceiveBufferSize(int32 size) {
NOTIMPLEMENTED();
return net::ERR_NOT_IMPLEMENTED;
return false;
}
int FakeSocket::SetSendBufferSize(int32 size) {
bool FakeSocket::SetSendBufferSize(int32 size) {
NOTIMPLEMENTED();
return net::ERR_NOT_IMPLEMENTED;
return false;
}
int FakeSocket::Connect(const net::CompletionCallback& callback) {
......
......@@ -45,8 +45,8 @@ class FakeSocket : public net::StreamSocket {
const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
virtual void Disconnect() OVERRIDE;
virtual bool IsConnected() const OVERRIDE;
......
......@@ -95,7 +95,7 @@ bool P2PSocketHostUdp::Init(const net::IPEndPoint& local_address,
}
// Setting recv socket buffer size.
if (socket_->SetReceiveBufferSize(kRecvSocketBufferSize) != net::OK) {
if (!socket_->SetReceiveBufferSize(kRecvSocketBufferSize)) {
LOG(WARNING) << "Failed to set socket receive buffer size to "
<< kRecvSocketBufferSize;
}
......@@ -302,9 +302,9 @@ bool P2PSocketHostUdp::SetOption(P2PSocketOption option, int value) {
DCHECK_EQ(STATE_OPEN, state_);
switch (option) {
case P2P_SOCKET_OPT_RCVBUF:
return socket_->SetReceiveBufferSize(value) == net::OK;
return socket_->SetReceiveBufferSize(value);
case P2P_SOCKET_OPT_SNDBUF:
return socket_->SetSendBufferSize(value) == net::OK;
return socket_->SetSendBufferSize(value);
case P2P_SOCKET_OPT_DSCP:
return (net::OK == socket_->SetDiffServCodePoint(
static_cast<net::DiffServCodePoint>(value))) ? true : false;
......
......@@ -94,12 +94,12 @@ class FakeDatagramServerSocket : public net::DatagramServerSocket {
return buf_len;
}
virtual int SetReceiveBufferSize(int32 size) OVERRIDE {
return net::OK;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE {
return true;
}
virtual int SetSendBufferSize(int32 size) OVERRIDE {
return net::OK;
virtual bool SetSendBufferSize(int32 size) OVERRIDE {
return true;
}
void ReceivePacket(const net::IPEndPoint& address, std::vector<char> data) {
......
......@@ -254,22 +254,21 @@ void PepperTCPSocket::SetOption(PP_TCPSocket_Option name,
return;
}
int net_result = net::OK;
bool result = false;
if (name == PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE) {
if (integer_value > ppapi::TCPSocketShared::kMaxSendBufferSize) {
SendSetOptionACK(PP_ERROR_BADARGUMENT);
return;
}
net_result = tcp_socket->SetSendBufferSize(integer_value);
result = tcp_socket->SetSendBufferSize(integer_value);
} else {
if (integer_value > ppapi::TCPSocketShared::kMaxReceiveBufferSize) {
SendSetOptionACK(PP_ERROR_BADARGUMENT);
return;
}
net_result = tcp_socket->SetReceiveBufferSize(integer_value);
result = tcp_socket->SetReceiveBufferSize(integer_value);
}
// TODO(wtc): Add error mapping.
SendSetOptionACK((net_result == net::OK) ? PP_OK : PP_ERROR_FAILED);
SendSetOptionACK(result ? PP_OK : PP_ERROR_FAILED);
return;
}
default: {
......
......@@ -455,18 +455,17 @@ int32_t PepperTCPSocketMessageFilter::OnMsgSetOption(
if (!value.GetInt32(&integer_value) || integer_value <= 0)
return PP_ERROR_BADARGUMENT;
int net_result = net::OK;
bool result = false;
if (name == PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE) {
if (integer_value > TCPSocketResourceBase::kMaxSendBufferSize)
return PP_ERROR_BADARGUMENT;
net_result = socket_->SetSendBufferSize(integer_value);
result = socket_->SetSendBufferSize(integer_value);
} else {
if (integer_value > TCPSocketResourceBase::kMaxReceiveBufferSize)
return PP_ERROR_BADARGUMENT;
net_result = socket_->SetReceiveBufferSize(integer_value);
result = socket_->SetReceiveBufferSize(integer_value);
}
// TODO(wtc): Add error mapping code.
return (net_result == net::OK) ? PP_OK : PP_ERROR_FAILED;
return result ? PP_OK : PP_ERROR_FAILED;
}
default: {
NOTREACHED();
......
......@@ -140,22 +140,21 @@ int32_t PepperUDPSocketMessageFilter::OnMsgSetOption(
if (!value.GetInt32(&integer_value) || integer_value <= 0)
return PP_ERROR_BADARGUMENT;
int net_result = net::OK;
bool result = false;
if (name == PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE) {
if (integer_value >
ppapi::proxy::UDPSocketResourceBase::kMaxSendBufferSize) {
return PP_ERROR_BADARGUMENT;
}
net_result = socket_->SetSendBufferSize(integer_value);
result = socket_->SetSendBufferSize(integer_value);
} else {
if (integer_value >
ppapi::proxy::UDPSocketResourceBase::kMaxReceiveBufferSize) {
return PP_ERROR_BADARGUMENT;
}
net_result = socket_->SetReceiveBufferSize(integer_value);
result = socket_->SetReceiveBufferSize(integer_value);
}
// TODO(wtc): Add error mapping code.
return (net_result == net::OK) ? PP_OK : PP_ERROR_FAILED;
return result ? PP_OK : PP_ERROR_FAILED;
}
default: {
NOTREACHED();
......
......@@ -99,16 +99,14 @@ int TransportChannelSocketAdapter::Write(
return result;
}
int TransportChannelSocketAdapter::SetReceiveBufferSize(int32 size) {
bool TransportChannelSocketAdapter::SetReceiveBufferSize(int32 size) {
DCHECK_EQ(base::MessageLoop::current(), message_loop_);
return (channel_->SetOption(talk_base::Socket::OPT_RCVBUF, size) == 0) ?
net::OK : net::ERR_SOCKET_SET_RECEIVE_BUFFER_SIZE_ERROR;
return channel_->SetOption(talk_base::Socket::OPT_RCVBUF, size) == 0;
}
int TransportChannelSocketAdapter::SetSendBufferSize(int32 size) {
bool TransportChannelSocketAdapter::SetSendBufferSize(int32 size) {
DCHECK_EQ(base::MessageLoop::current(), message_loop_);
return (channel_->SetOption(talk_base::Socket::OPT_SNDBUF, size) == 0) ?
net::OK : net::ERR_SOCKET_SET_SEND_BUFFER_SIZE_ERROR;
return channel_->SetOption(talk_base::Socket::OPT_SNDBUF, size) == 0;
}
void TransportChannelSocketAdapter::Close(int error_code) {
......
......@@ -48,8 +48,8 @@ class TransportChannelSocketAdapter : public net::Socket,
virtual int Write(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
private:
void OnNewPacket(cricket::TransportChannel* channel,
......
......@@ -103,11 +103,11 @@ int FakeSSLClientSocket::Write(net::IOBuffer* buf, int buf_len,
return transport_socket_->Write(buf, buf_len, callback);
}
int FakeSSLClientSocket::SetReceiveBufferSize(int32 size) {
bool FakeSSLClientSocket::SetReceiveBufferSize(int32 size) {
return transport_socket_->SetReceiveBufferSize(size);
}
int FakeSSLClientSocket::SetSendBufferSize(int32 size) {
bool FakeSSLClientSocket::SetSendBufferSize(int32 size) {
return transport_socket_->SetSendBufferSize(size);
}
......
......@@ -49,8 +49,8 @@ class FakeSSLClientSocket : public net::StreamSocket {
const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
virtual void Disconnect() OVERRIDE;
virtual bool IsConnected() const OVERRIDE;
......
......@@ -50,8 +50,8 @@ class MockClientSocket : public net::StreamSocket {
const net::CompletionCallback&));
MOCK_METHOD3(Write, int(net::IOBuffer*, int,
const net::CompletionCallback&));
MOCK_METHOD1(SetReceiveBufferSize, int(int32));
MOCK_METHOD1(SetSendBufferSize, int(int32));
MOCK_METHOD1(SetReceiveBufferSize, bool(int32));
MOCK_METHOD1(SetSendBufferSize, bool(int32));
MOCK_METHOD1(Connect, int(const net::CompletionCallback&));
MOCK_METHOD0(Disconnect, void());
MOCK_CONST_METHOD0(IsConnected, bool());
......
......@@ -107,18 +107,18 @@ int ProxyResolvingClientSocket::Write(
return net::ERR_SOCKET_NOT_CONNECTED;
}
int ProxyResolvingClientSocket::SetReceiveBufferSize(int32 size) {
bool ProxyResolvingClientSocket::SetReceiveBufferSize(int32 size) {
if (transport_.get() && transport_->socket())
return transport_->socket()->SetReceiveBufferSize(size);
NOTREACHED();
return net::ERR_SOCKET_NOT_CONNECTED;
return false;
}
int ProxyResolvingClientSocket::SetSendBufferSize(int32 size) {
bool ProxyResolvingClientSocket::SetSendBufferSize(int32 size) {
if (transport_.get() && transport_->socket())
return transport_->socket()->SetSendBufferSize(size);
NOTREACHED();
return net::ERR_SOCKET_NOT_CONNECTED;
return false;
}
int ProxyResolvingClientSocket::Connect(
......
......@@ -52,8 +52,8 @@ class ProxyResolvingClientSocket : public net::StreamSocket {
const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
virtual void Disconnect() OVERRIDE;
virtual bool IsConnected() const OVERRIDE;
......
......@@ -484,18 +484,18 @@ int PseudoTcpAdapter::Write(net::IOBuffer* buffer, int buffer_size,
return core_->Write(buffer, buffer_size, callback);
}
int PseudoTcpAdapter::SetReceiveBufferSize(int32 size) {
bool PseudoTcpAdapter::SetReceiveBufferSize(int32 size) {
DCHECK(CalledOnValidThread());
core_->SetReceiveBufferSize(size);
return net::OK;
return false;
}
int PseudoTcpAdapter::SetSendBufferSize(int32 size) {
bool PseudoTcpAdapter::SetSendBufferSize(int32 size) {
DCHECK(CalledOnValidThread());
core_->SetSendBufferSize(size);
return net::OK;
return false;
}
int PseudoTcpAdapter::Connect(const net::CompletionCallback& callback) {
......
......@@ -34,8 +34,8 @@ class PseudoTcpAdapter : public net::StreamSocket, base::NonThreadSafe {
const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buffer, int buffer_size,
const net::CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
// net::StreamSocket implementation.
virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
......
......@@ -142,13 +142,13 @@ class FakeSocket : public net::Socket {
return buf_len;
}
virtual int SetReceiveBufferSize(int32 size) OVERRIDE {
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE {
NOTIMPLEMENTED();
return net::ERR_NOT_IMPLEMENTED;
return false;
}
virtual int SetSendBufferSize(int32 size) OVERRIDE {
virtual bool SetSendBufferSize(int32 size) OVERRIDE {
NOTIMPLEMENTED();
return net::ERR_NOT_IMPLEMENTED;
return false;
}
private:
......
......@@ -313,20 +313,12 @@ NET_ERROR(CT_NO_SCTS_VERIFIED_OK, -158)
// The SSL server sent us a fatal unrecognized_name alert.
NET_ERROR(SSL_UNRECOGNIZED_NAME_ALERT, -159)
// Failed to set the socket's receive buffer size as requested.
// Failed to set or change the socket's receive buffer size as requested
NET_ERROR(SOCKET_SET_RECEIVE_BUFFER_SIZE_ERROR, -160)
// Failed to set the socket's send buffer size as requested.
// Failed to set or change the socket's send buffer size as requested.
NET_ERROR(SOCKET_SET_SEND_BUFFER_SIZE_ERROR, -161)
// Failed to set the socket's receive buffer size as requested, despite success
// return code from setsockopt.
NET_ERROR(SOCKET_RECEIVE_BUFFER_SIZE_UNCHANGEABLE, -162)
// Failed to set the socket's send buffer size as requested, despite success
// return code from setsockopt.
NET_ERROR(SOCKET_SEND_BUFFER_SIZE_UNCHANGEABLE, -163)
// Certificate error codes
//
// The values of certificate error codes must be consecutive.
......
......@@ -43,11 +43,11 @@ class TestUDPClientSocket : public DatagramClientSocket {
NOTIMPLEMENTED();
return OK;
}
virtual int SetReceiveBufferSize(int32) OVERRIDE {
return OK;
virtual bool SetReceiveBufferSize(int32) OVERRIDE {
return true;
}
virtual int SetSendBufferSize(int32) OVERRIDE {
return OK;
virtual bool SetSendBufferSize(int32) OVERRIDE {
return true;
}
virtual void Close() OVERRIDE {}
......
......@@ -33,8 +33,8 @@ class MockMDnsDatagramServerSocket : public DatagramServerSocket {
const std::string address,
const CompletionCallback& callback));
MOCK_METHOD1(SetReceiveBufferSize, int(int32 size));
MOCK_METHOD1(SetSendBufferSize, int(int32 size));
MOCK_METHOD1(SetReceiveBufferSize, bool(int32 size));
MOCK_METHOD1(SetSendBufferSize, bool(int32 size));
MOCK_METHOD0(Close, void());
......
......@@ -237,11 +237,11 @@ int HttpProxyClientSocket::Write(IOBuffer* buf, int buf_len,
return transport_->socket()->Write(buf, buf_len, callback);
}
int HttpProxyClientSocket::SetReceiveBufferSize(int32 size) {
bool HttpProxyClientSocket::SetReceiveBufferSize(int32 size) {
return transport_->socket()->SetReceiveBufferSize(size);
}
int HttpProxyClientSocket::SetSendBufferSize(int32 size) {
bool HttpProxyClientSocket::SetSendBufferSize(int32 size) {
return transport_->socket()->SetSendBufferSize(size);
}
......
......@@ -82,8 +82,8 @@ class HttpProxyClientSocket : public ProxyClientSocket {
virtual int Write(IOBuffer* buf,
int buf_len,
const CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE;
virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
......
......@@ -722,18 +722,16 @@ int QuicStreamFactory::CreateSession(
// does not consume "too much" memory. If we see bursty packet loss, we may
// revisit this setting and test for its impact.
const int32 kSocketBufferSize(TcpReceiver::kReceiveWindowTCP);
rv = socket->SetReceiveBufferSize(kSocketBufferSize);
if (rv != OK) {
if (!socket->SetReceiveBufferSize(kSocketBufferSize)) {
HistogramCreateSessionFailure(CREATION_ERROR_SETTING_RECEIVE_BUFFER);
return rv;
return ERR_SOCKET_SET_RECEIVE_BUFFER_SIZE_ERROR;
}
// Set a buffer large enough to contain the initial CWND's worth of packet
// to work around the problem with CHLO packets being sent out with the
// wrong encryption level, when the send buffer is full.
rv = socket->SetSendBufferSize(kMaxPacketSize * 20);
if (rv != OK) {
if (!socket->SetSendBufferSize(kMaxPacketSize * 20)) {
HistogramCreateSessionFailure(CREATION_ERROR_SETTING_SEND_BUFFER);
return rv;
return ERR_SOCKET_SET_SEND_BUFFER_SIZE_ERROR;
}
scoped_ptr<QuicDefaultPacketWriter> writer(
......
......@@ -59,11 +59,11 @@ int BufferedWriteStreamSocket::Write(IOBuffer* buf, int buf_len,
return buf_len;
}
int BufferedWriteStreamSocket::SetReceiveBufferSize(int32 size) {
bool BufferedWriteStreamSocket::SetReceiveBufferSize(int32 size) {
return wrapped_socket_->SetReceiveBufferSize(size);
}
int BufferedWriteStreamSocket::SetSendBufferSize(int32 size) {
bool BufferedWriteStreamSocket::SetSendBufferSize(int32 size) {
return wrapped_socket_->SetSendBufferSize(size);
}
......
......@@ -43,8 +43,8 @@ class NET_EXPORT_PRIVATE BufferedWriteStreamSocket : public StreamSocket {
const CompletionCallback& callback) OVERRIDE;
virtual int Write(IOBuffer* buf, int buf_len,
const CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
// StreamSocket interface
virtual int Connect(const CompletionCallback& callback) OVERRIDE;
......
......@@ -145,8 +145,8 @@ class MockClientSocket : public StreamSocket {
was_used_to_convey_data_ = true;
return len;
}
virtual int SetReceiveBufferSize(int32 size) OVERRIDE { return OK; }
virtual int SetSendBufferSize(int32 size) OVERRIDE { return OK; }
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE { return true; }
virtual bool SetSendBufferSize(int32 size) OVERRIDE { return true; }
// StreamSocket implementation.
virtual int Connect(const CompletionCallback& callback) OVERRIDE {
......
......@@ -48,13 +48,13 @@ class NET_EXPORT Socket {
// Set the receive buffer size (in bytes) for the socket.
// Note: changing this value can affect the TCP window size on some platforms.
// Returns a net error code.
virtual int SetReceiveBufferSize(int32 size) = 0;
// Returns true on success, or false on failure.
virtual bool SetReceiveBufferSize(int32 size) = 0;
// Set the send buffer size (in bytes) for the socket.
// Note: changing this value can affect the TCP window size on some platforms.
// Returns a net error code.
virtual int SetSendBufferSize(int32 size) = 0;
// Returns true on success, or false on failure.
virtual bool SetSendBufferSize(int32 size) = 0;
};
} // namespace net
......
......@@ -713,12 +713,12 @@ MockClientSocket::MockClientSocket(const BoundNetLog& net_log)
peer_addr_ = IPEndPoint(ip, 0);
}
int MockClientSocket::SetReceiveBufferSize(int32 size) {
return OK;
bool MockClientSocket::SetReceiveBufferSize(int32 size) {
return true;
}
int MockClientSocket::SetSendBufferSize(int32 size) {
return OK;
bool MockClientSocket::SetSendBufferSize(int32 size) {
return true;
}
void MockClientSocket::Disconnect() {
......@@ -1162,12 +1162,12 @@ int DeterministicMockUDPClientSocket::Read(
return helper_.Read(buf, buf_len, callback);
}
int DeterministicMockUDPClientSocket::SetReceiveBufferSize(int32 size) {
return OK;
bool DeterministicMockUDPClientSocket::SetReceiveBufferSize(int32 size) {
return true;
}
int DeterministicMockUDPClientSocket::SetSendBufferSize(int32 size) {
return OK;
bool DeterministicMockUDPClientSocket::SetSendBufferSize(int32 size) {
return true;
}
void DeterministicMockUDPClientSocket::Close() {
......@@ -1508,12 +1508,12 @@ int MockUDPClientSocket::Write(IOBuffer* buf, int buf_len,
return write_result.result;
}
int MockUDPClientSocket::SetReceiveBufferSize(int32 size) {
return OK;
bool MockUDPClientSocket::SetReceiveBufferSize(int32 size) {
return true;
}
int MockUDPClientSocket::SetSendBufferSize(int32 size) {
return OK;
bool MockUDPClientSocket::SetSendBufferSize(int32 size) {
return true;
}
void MockUDPClientSocket::Close() {
......
......@@ -675,8 +675,8 @@ class MockClientSocket : public SSLClientSocket {
virtual int Write(IOBuffer* buf,
int buf_len,
const CompletionCallback& callback) = 0;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
// StreamSocket implementation.
virtual int Connect(const CompletionCallback& callback) = 0;
......@@ -850,8 +850,8 @@ class DeterministicMockUDPClientSocket
virtual int Write(IOBuffer* buf,
int buf_len,
const CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
// DatagramSocket implementation.
virtual void Close() OVERRIDE;
......@@ -992,8 +992,8 @@ class MockUDPClientSocket : public DatagramClientSocket, public AsyncSocket {
virtual int Write(IOBuffer* buf,
int buf_len,
const CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
// DatagramSocket implementation.
virtual void Close() OVERRIDE;
......
......@@ -183,11 +183,11 @@ int SOCKS5ClientSocket::Write(IOBuffer* buf, int buf_len,
return rv;
}
int SOCKS5ClientSocket::SetReceiveBufferSize(int32 size) {
bool SOCKS5ClientSocket::SetReceiveBufferSize(int32 size) {
return transport_->socket()->SetReceiveBufferSize(size);
}
int SOCKS5ClientSocket::SetSendBufferSize(int32 size) {
bool SOCKS5ClientSocket::SetSendBufferSize(int32 size) {
return transport_->socket()->SetSendBufferSize(size);
}
......
......@@ -64,8 +64,8 @@ class NET_EXPORT_PRIVATE SOCKS5ClientSocket : public StreamSocket {
int buf_len,
const CompletionCallback& callback) OVERRIDE;
virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
virtual int SetSendBufferSize(int32 size) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;