summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-05 03:09:04 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-05 03:09:04 +0000
commit88e03fa16a2ed1a178822d4ba46dd96a276815a4 (patch)
treeaafed5350e0a5da62b70d277db84d0ee87512a33 /net/spdy
parentb3d75b91d5160d03e5e58ea430cfc5f33f2eee32 (diff)
downloadchromium_src-88e03fa16a2ed1a178822d4ba46dd96a276815a4.zip
chromium_src-88e03fa16a2ed1a178822d4ba46dd96a276815a4.tar.gz
chromium_src-88e03fa16a2ed1a178822d4ba46dd96a276815a4.tar.bz2
Clarify the semantics of Socket::Read() and Socket::Write(),
particularly as they related to closed / disconnected sockets. Added a new ERR_SOCKET_NOT_CONNECTED error which is now returned by GetPeerAddress. This addresses wtc's feedback on CL 3421028. BUG=56423,56426 TEST=none Review URL: http://codereview.chromium.org/3384034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_proxy_client_socket.cc2
-rw-r--r--net/spdy/spdy_proxy_client_socket_unittest.cc6
2 files changed, 5 insertions, 3 deletions
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc
index e282d76..966a82c 100644
--- a/net/spdy/spdy_proxy_client_socket.cc
+++ b/net/spdy/spdy_proxy_client_socket.cc
@@ -209,7 +209,7 @@ bool SpdyProxyClientSocket::SetSendBufferSize(int32 size) {
int SpdyProxyClientSocket::GetPeerAddress(AddressList* address) const {
if (!IsConnected())
- return ERR_UNEXPECTED;
+ return ERR_SOCKET_NOT_CONNECTED;
return spdy_stream_->GetPeerAddress(address);
}
diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc
index daf158c..274c22f 100644
--- a/net/spdy/spdy_proxy_client_socket_unittest.cc
+++ b/net/spdy/spdy_proxy_client_socket_unittest.cc
@@ -521,12 +521,14 @@ TEST_F(SpdyProxyClientSocketTest, GetPeerAddressReturnsCorrectValues) {
Initialize(reads, arraysize(reads), writes, arraysize(writes));
net::AddressList addr;
- EXPECT_EQ(ERR_UNEXPECTED, sock_->GetPeerAddress(&addr));
+ EXPECT_EQ(ERR_SOCKET_NOT_CONNECTED, sock_->GetPeerAddress(&addr));
+
AssertConnectSucceeds();
EXPECT_TRUE(sock_->IsConnected());
EXPECT_EQ(OK, sock_->GetPeerAddress(&addr));
+
sock_->Disconnect();
- EXPECT_EQ(ERR_UNEXPECTED, sock_->GetPeerAddress(&addr));
+ EXPECT_EQ(ERR_SOCKET_NOT_CONNECTED, sock_->GetPeerAddress(&addr));
}
// ----------- Write