OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 NET_SOCKET_TCP_PINGER_H_ | 5 #ifndef NET_SOCKET_TCP_PINGER_H_ |
6 #define NET_SOCKET_TCP_PINGER_H_ | 6 #define NET_SOCKET_TCP_PINGER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 explicit Worker(const net::AddressList& addr) | 79 explicit Worker(const net::AddressList& addr) |
80 : event_(false, false), | 80 : event_(false, false), |
81 net_error_(ERR_IO_PENDING), | 81 net_error_(ERR_IO_PENDING), |
82 addr_(addr), | 82 addr_(addr), |
83 ALLOW_THIS_IN_INITIALIZER_LIST(connect_callback_(this, | 83 ALLOW_THIS_IN_INITIALIZER_LIST(connect_callback_(this, |
84 &net::TCPPinger::Worker::ConnectDone)) { | 84 &net::TCPPinger::Worker::ConnectDone)) { |
85 } | 85 } |
86 | 86 |
87 void DoConnect() { | 87 void DoConnect() { |
88 sock_.reset(new TCPClientSocket(addr_)); | 88 sock_.reset(new TCPClientSocket(addr_)); |
89 int rv = sock_->Connect(&connect_callback_); | 89 int rv = sock_->Connect(&connect_callback_, NULL); |
90 // Regardless of success or failure, if we're done now, | 90 // Regardless of success or failure, if we're done now, |
91 // signal the customer. | 91 // signal the customer. |
92 if (rv != ERR_IO_PENDING) | 92 if (rv != ERR_IO_PENDING) |
93 ConnectDone(rv); | 93 ConnectDone(rv); |
94 } | 94 } |
95 | 95 |
96 void DoDisconnect() { | 96 void DoDisconnect() { |
97 sock_.reset(); | 97 sock_.reset(); |
98 event_.Signal(); | 98 event_.Signal(); |
99 } | 99 } |
(...skipping 23 matching lines...) Expand all Loading... |
123 }; | 123 }; |
124 | 124 |
125 base::Thread io_thread_; | 125 base::Thread io_thread_; |
126 Worker* worker_; | 126 Worker* worker_; |
127 DISALLOW_COPY_AND_ASSIGN(TCPPinger); | 127 DISALLOW_COPY_AND_ASSIGN(TCPPinger); |
128 }; | 128 }; |
129 | 129 |
130 } // namespace net | 130 } // namespace net |
131 | 131 |
132 #endif // NET_SOCKET_TCP_PINGER_H_ | 132 #endif // NET_SOCKET_TCP_PINGER_H_ |
OLD | NEW |