summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 23:49:35 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 23:49:35 +0000
commite7f74dada8e347bde1e7e88e88d6fd3c9882375a (patch)
treed563b0762ffe6062005b24e277dd1bb4a8019aef /net/spdy
parent15ff0118ad82bfc4b89ad612f130fed0df512612 (diff)
downloadchromium_src-e7f74dada8e347bde1e7e88e88d6fd3c9882375a.zip
chromium_src-e7f74dada8e347bde1e7e88e88d6fd3c9882375a.tar.gz
chromium_src-e7f74dada8e347bde1e7e88e88d6fd3c9882375a.tar.bz2
Added GetLocalAddress() in net::ClientSocket.
BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/6840033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82190 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_proxy_client_socket.cc6
-rw-r--r--net/spdy/spdy_proxy_client_socket.h1
-rw-r--r--net/spdy/spdy_session.cc8
-rw-r--r--net/spdy/spdy_session.h5
-rw-r--r--net/spdy/spdy_stream.cc4
-rw-r--r--net/spdy/spdy_stream.h2
6 files changed, 23 insertions, 3 deletions
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc
index f451868..d34743e 100644
--- a/net/spdy/spdy_proxy_client_socket.cc
+++ b/net/spdy/spdy_proxy_client_socket.cc
@@ -245,6 +245,12 @@ int SpdyProxyClientSocket::GetPeerAddress(AddressList* address) const {
return spdy_stream_->GetPeerAddress(address);
}
+int SpdyProxyClientSocket::GetLocalAddress(IPEndPoint* address) const {
+ if (!IsConnected())
+ return ERR_SOCKET_NOT_CONNECTED;
+ return spdy_stream_->GetLocalAddress(address);
+}
+
void SpdyProxyClientSocket::OnIOComplete(int result) {
DCHECK_NE(STATE_DISCONNECTED, next_state_);
int rv = DoLoop(result);
diff --git a/net/spdy/spdy_proxy_client_socket.h b/net/spdy/spdy_proxy_client_socket.h
index d57b10f..6f506d7 100644
--- a/net/spdy/spdy_proxy_client_socket.h
+++ b/net/spdy/spdy_proxy_client_socket.h
@@ -84,6 +84,7 @@ class SpdyProxyClientSocket : public ProxyClientSocket,
virtual bool SetReceiveBufferSize(int32 size);
virtual bool SetSendBufferSize(int32 size);
virtual int GetPeerAddress(AddressList* address) const;
+ virtual int GetLocalAddress(IPEndPoint* address) const;
// SpdyStream::Delegate methods:
virtual bool OnSendHeadersComplete(int status);
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 305ee35..d4629a0 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -899,6 +899,14 @@ Value* SpdySession::GetInfoAsValue() const {
return dict;
}
+int SpdySession::GetPeerAddress(AddressList* address) const {
+ return connection_->socket()->GetPeerAddress(address);
+}
+
+int SpdySession::GetLocalAddress(IPEndPoint* address) const {
+ return connection_->socket()->GetLocalAddress(address);
+}
+
void SpdySession::ActivateStream(SpdyStream* stream) {
const spdy::SpdyStreamId id = stream->stream_id();
DCHECK(!IsStreamActive(id));
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index a4e1edc..46d1903 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -198,9 +198,8 @@ class SpdySession : public base::RefCounted<SpdySession>,
const BoundNetLog& net_log() const { return net_log_; }
- int GetPeerAddress(AddressList* address) const {
- return connection_->socket()->GetPeerAddress(address);
- }
+ int GetPeerAddress(AddressList* address) const;
+ int GetLocalAddress(IPEndPoint* address) const;
private:
friend class base::RefCounted<SpdySession>;
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index e948b33..5808907 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -218,6 +218,10 @@ int SpdyStream::GetPeerAddress(AddressList* address) const {
return session_->GetPeerAddress(address);
}
+int SpdyStream::GetLocalAddress(IPEndPoint* address) const {
+ return session_->GetLocalAddress(address);
+}
+
bool SpdyStream::WasEverUsed() const {
return session_->WasEverUsed();
}
diff --git a/net/spdy/spdy_stream.h b/net/spdy/spdy_stream.h
index 186d0ec..a2fefd9 100644
--- a/net/spdy/spdy_stream.h
+++ b/net/spdy/spdy_stream.h
@@ -24,6 +24,7 @@
namespace net {
class AddressList;
+class IPEndPoint;
class SpdySession;
class SSLCertRequestInfo;
class SSLInfo;
@@ -143,6 +144,7 @@ class SpdyStream
void DecreaseSendWindowSize(int delta_window_size);
int GetPeerAddress(AddressList* address) const;
+ int GetLocalAddress(IPEndPoint* address) const;
// Returns true if the underlying transport socket ever had any reads or
// writes.