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

Side by Side Diff: remoting/jingle_glue/ssl_socket_adapter.h

Issue 10543069: Fix SSLSocketAdapter to handle asynchronous writes appropriately. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/jingle_glue/ssl_socket_adapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ 5 #ifndef REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_
6 #define REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ 6 #define REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 virtual int Send(const void* pv, size_t cb) OVERRIDE; 109 virtual int Send(const void* pv, size_t cb) OVERRIDE;
110 virtual int Recv(void* pv, size_t cb) OVERRIDE; 110 virtual int Recv(void* pv, size_t cb) OVERRIDE;
111 111
112 private: 112 private:
113 friend class TransportSocket; 113 friend class TransportSocket;
114 114
115 enum SSLState { 115 enum SSLState {
116 SSLSTATE_NONE, 116 SSLSTATE_NONE,
117 SSLSTATE_WAIT, 117 SSLSTATE_WAIT,
118 SSLSTATE_CONNECTED, 118 SSLSTATE_CONNECTED,
119 }; 119 SSLSTATE_ERROR,
120
121 enum IOState {
122 IOSTATE_NONE,
123 IOSTATE_PENDING,
124 IOSTATE_COMPLETE,
125 }; 120 };
126 121
127 void OnConnected(int result); 122 void OnConnected(int result);
128 void OnRead(int result); 123 void OnRead(int result);
129 void OnWrite(int result); 124 void OnWritten(int result);
125
126 void DoWrite();
130 127
131 virtual void OnConnectEvent(talk_base::AsyncSocket* socket) OVERRIDE; 128 virtual void OnConnectEvent(talk_base::AsyncSocket* socket) OVERRIDE;
132 129
133 int BeginSSL(); 130 int BeginSSL();
134 131
135 bool ignore_bad_cert_; 132 bool ignore_bad_cert_;
136 std::string hostname_; 133 std::string hostname_;
137 TransportSocket* transport_socket_; 134 TransportSocket* transport_socket_;
138 135
139 // |cert_verifier_| must be defined before |ssl_socket_|, so that 136 // |cert_verifier_| must be defined before |ssl_socket_|, so that
140 // it's destroyed after |ssl_socket_|. 137 // it's destroyed after |ssl_socket_|.
141 scoped_ptr<net::CertVerifier> cert_verifier_; 138 scoped_ptr<net::CertVerifier> cert_verifier_;
142 scoped_ptr<net::SSLClientSocket> ssl_socket_; 139 scoped_ptr<net::SSLClientSocket> ssl_socket_;
143 140
144 SSLState ssl_state_; 141 SSLState ssl_state_;
145 IOState read_state_; 142
146 IOState write_state_; 143 bool read_pending_;
147 scoped_refptr<net::IOBuffer> transport_buf_; 144 scoped_refptr<net::GrowableIOBuffer> read_buffer_;
148 int data_transferred_; 145
146 bool write_pending_;
147 scoped_refptr<net::DrainableIOBuffer> write_buffer_;
149 148
150 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter); 149 DISALLOW_COPY_AND_ASSIGN(SSLSocketAdapter);
151 }; 150 };
152 151
153 } // namespace remoting 152 } // namespace remoting
154 153
155 #endif // REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_ 154 #endif // REMOTING_JINGLE_GLUE_SSL_SOCKET_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/jingle_glue/ssl_socket_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698