| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_P2P_BASE_TCPPORT_H_ | 11 #ifndef WEBRTC_P2P_BASE_TCPPORT_H_ |
| 12 #define WEBRTC_P2P_BASE_TCPPORT_H_ | 12 #define WEBRTC_P2P_BASE_TCPPORT_H_ |
| 13 | 13 |
| 14 #include <list> | 14 #include <list> |
| 15 #include <memory> |
| 15 #include <string> | 16 #include <string> |
| 17 |
| 16 #include "webrtc/p2p/base/port.h" | 18 #include "webrtc/p2p/base/port.h" |
| 17 #include "webrtc/base/asyncpacketsocket.h" | 19 #include "webrtc/base/asyncpacketsocket.h" |
| 18 | 20 |
| 19 namespace cricket { | 21 namespace cricket { |
| 20 | 22 |
| 21 class TCPConnection; | 23 class TCPConnection; |
| 22 | 24 |
| 23 // Communicates using a local TCP port. | 25 // Communicates using a local TCP port. |
| 24 // | 26 // |
| 25 // This class is designed to allow subclasses to take advantage of the | 27 // This class is designed to allow subclasses to take advantage of the |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 void ConnectSocketSignals(rtc::AsyncPacketSocket* socket); | 159 void ConnectSocketSignals(rtc::AsyncPacketSocket* socket); |
| 158 | 160 |
| 159 void OnConnect(rtc::AsyncPacketSocket* socket); | 161 void OnConnect(rtc::AsyncPacketSocket* socket); |
| 160 void OnClose(rtc::AsyncPacketSocket* socket, int error); | 162 void OnClose(rtc::AsyncPacketSocket* socket, int error); |
| 161 void OnReadPacket(rtc::AsyncPacketSocket* socket, | 163 void OnReadPacket(rtc::AsyncPacketSocket* socket, |
| 162 const char* data, size_t size, | 164 const char* data, size_t size, |
| 163 const rtc::SocketAddress& remote_addr, | 165 const rtc::SocketAddress& remote_addr, |
| 164 const rtc::PacketTime& packet_time); | 166 const rtc::PacketTime& packet_time); |
| 165 void OnReadyToSend(rtc::AsyncPacketSocket* socket); | 167 void OnReadyToSend(rtc::AsyncPacketSocket* socket); |
| 166 | 168 |
| 167 rtc::scoped_ptr<rtc::AsyncPacketSocket> socket_; | 169 std::unique_ptr<rtc::AsyncPacketSocket> socket_; |
| 168 int error_; | 170 int error_; |
| 169 bool outgoing_; | 171 bool outgoing_; |
| 170 | 172 |
| 171 // Guard against multiple outgoing tcp connection during a reconnect. | 173 // Guard against multiple outgoing tcp connection during a reconnect. |
| 172 bool connection_pending_; | 174 bool connection_pending_; |
| 173 | 175 |
| 174 // Guard against data packets sent when we reconnect a TCP connection. During | 176 // Guard against data packets sent when we reconnect a TCP connection. During |
| 175 // reconnecting, when a new tcp connection has being made, we can't send data | 177 // reconnecting, when a new tcp connection has being made, we can't send data |
| 176 // packets out until the STUN binding is completed (i.e. the write state is | 178 // packets out until the STUN binding is completed (i.e. the write state is |
| 177 // set to WRITABLE again by Connection::OnConnectionRequestResponse). IPC | 179 // set to WRITABLE again by Connection::OnConnectionRequestResponse). IPC |
| 178 // socket, when receiving data packets before that, will trigger OnError which | 180 // socket, when receiving data packets before that, will trigger OnError which |
| 179 // will terminate the newly created connection. | 181 // will terminate the newly created connection. |
| 180 bool pretending_to_be_writable_; | 182 bool pretending_to_be_writable_; |
| 181 | 183 |
| 182 // Allow test case to overwrite the default timeout period. | 184 // Allow test case to overwrite the default timeout period. |
| 183 int reconnection_timeout_; | 185 int reconnection_timeout_; |
| 184 | 186 |
| 185 friend class TCPPort; | 187 friend class TCPPort; |
| 186 }; | 188 }; |
| 187 | 189 |
| 188 } // namespace cricket | 190 } // namespace cricket |
| 189 | 191 |
| 190 #endif // WEBRTC_P2P_BASE_TCPPORT_H_ | 192 #endif // WEBRTC_P2P_BASE_TCPPORT_H_ |
| OLD | NEW |