Index: chrome/browser/extensions/api/cast_channel/cast_socket.h |
diff --git a/chrome/browser/extensions/api/cast_channel/cast_socket.h b/chrome/browser/extensions/api/cast_channel/cast_socket.h |
index dba56d7196f75314ba0a6c59b4f4db566a787a12..d3b87358cd986a13ddcb94af3bc924c0a189a9e4 100644 |
--- a/chrome/browser/extensions/api/cast_channel/cast_socket.h |
+++ b/chrome/browser/extensions/api/cast_channel/cast_socket.h |
@@ -10,6 +10,7 @@ |
#include "base/basictypes.h" |
#include "base/callback.h" |
+#include "base/cancelable_callback.h" |
#include "base/gtest_prod_util.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/weak_ptr.h" |
@@ -68,7 +69,8 @@ class CastSocket : public ApiResource, |
const net::IPEndPoint& ip_endpoint, |
ChannelAuthType channel_auth, |
CastSocket::Delegate* delegate, |
- net::NetLog* net_log); |
+ net::NetLog* net_log, |
+ int64 timeout_ms); |
mark a. foltz
2014/07/15 22:18:15
connect_timeout_ms
Kevin M
2014/07/16 22:59:42
Done.
|
virtual ~CastSocket(); |
// The IP endpoint for the destination of the channel. |
@@ -191,6 +193,10 @@ class CastSocket : public ApiResource, |
// 2. Certificate is rooted to a trusted CA. |
virtual bool VerifyChallengeReply(); |
+ // Invoked by a cancelable closure when connection setup time |
+ // exceeds the interval specified at |timeout_interval_ms_|. |
+ void Timeout(); |
mark a. foltz
2014/07/15 22:18:15
CancelConnect()?
Kevin M
2014/07/16 22:59:42
Done.
|
+ |
///////////////////////////////////////////////////////////////////////////// |
// Following methods work together to implement the following flow: |
// 1. Create a new TCP socket and connect to it |
@@ -311,9 +317,15 @@ class CastSocket : public ApiResource, |
// Reply received from the receiver to a challenge request. |
scoped_ptr<CastMessage> challenge_reply_; |
- // Callback invoked when the socket is connected. |
+ // Callback invoked when the socket is connected or fails to connect. |
net::CompletionCallback connect_callback_; |
+ // Number of milliseconds to wait before timing out. |
+ int64 timeout_interval_ms_; |
mark a. foltz
2014/07/15 22:18:15
connect_timeout_ms_
Kevin M
2014/07/16 22:59:42
Done.
|
+ // Closure invoked when the connection has timed out. |
+ base::CancelableClosure timeout_callback_; |
mark a. foltz
2014/07/15 22:18:15
connect_timeout_callback_
Kevin M
2014/07/16 22:59:41
Done.
|
+ bool timed_out_; |
mark a. foltz
2014/07/15 22:18:15
connect_timed_out_
Kevin M
2014/07/16 22:59:42
Done. Removed this variable - code checks the erro
|
+ |
// Connection flow state machine state. |
ConnectionState connect_state_; |
// Write flow state machine state. |