summaryrefslogtreecommitdiffstats
path: root/net/base/ssl_client_socket_win.cc
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 23:27:33 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 23:27:33 +0000
commitb2197853ee021e8b6d1c4f3c46e475da372b6980 (patch)
tree3429dcfc22d7f3ec683bbe2c1923b208d78adb26 /net/base/ssl_client_socket_win.cc
parent814c99861aa1116c588a63b20dd1b7a4f9a974e0 (diff)
downloadchromium_src-b2197853ee021e8b6d1c4f3c46e475da372b6980.zip
chromium_src-b2197853ee021e8b6d1c4f3c46e475da372b6980.tar.gz
chromium_src-b2197853ee021e8b6d1c4f3c46e475da372b6980.tar.bz2
If an idle socket has received data unexpectedly, we can't
reuse it. Add the IsConnectedAndIdle method, which returns true if the connection is still alive and idle (hasn't received any data unexpectedly). R=eroman BUG=4606 Review URL: http://codereview.chromium.org/21501 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10060 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/ssl_client_socket_win.cc')
-rw-r--r--net/base/ssl_client_socket_win.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/base/ssl_client_socket_win.cc b/net/base/ssl_client_socket_win.cc
index 5f73746..6aba9c2 100644
--- a/net/base/ssl_client_socket_win.cc
+++ b/net/base/ssl_client_socket_win.cc
@@ -314,6 +314,17 @@ bool SSLClientSocketWin::IsConnected() const {
return completed_handshake_ && transport_->IsConnected();
}
+bool SSLClientSocketWin::IsConnectedAndIdle() const {
+ // Unlike IsConnected, this method doesn't return a false positive.
+ //
+ // Strictly speaking, we should check if we have received the close_notify
+ // alert message from the server, and return false in that case. Although
+ // the close_notify alert message means EOF in the SSL layer, it is just
+ // bytes to the transport layer below, so transport_->IsConnectedAndIdle()
+ // returns the desired false when we receive close_notify.
+ return completed_handshake_ && transport_->IsConnectedAndIdle();
+}
+
int SSLClientSocketWin::Read(char* buf, int buf_len,
CompletionCallback* callback) {
DCHECK(completed_handshake_);