Chromium Code Reviews| 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 extern const char UDP_PROTOCOL_NAME[]; | 43 extern const char UDP_PROTOCOL_NAME[]; |
| 44 extern const char TCP_PROTOCOL_NAME[]; | 44 extern const char TCP_PROTOCOL_NAME[]; |
| 45 extern const char SSLTCP_PROTOCOL_NAME[]; | 45 extern const char SSLTCP_PROTOCOL_NAME[]; |
| 46 | 46 |
| 47 // RFC 6544, TCP candidate encoding rules. | 47 // RFC 6544, TCP candidate encoding rules. |
| 48 extern const int DISCARD_PORT; | 48 extern const int DISCARD_PORT; |
| 49 extern const char TCPTYPE_ACTIVE_STR[]; | 49 extern const char TCPTYPE_ACTIVE_STR[]; |
| 50 extern const char TCPTYPE_PASSIVE_STR[]; | 50 extern const char TCPTYPE_PASSIVE_STR[]; |
| 51 extern const char TCPTYPE_SIMOPEN_STR[]; | 51 extern const char TCPTYPE_SIMOPEN_STR[]; |
| 52 | 52 |
| 53 // If a connection does not receive anything for this long, it is considered | 53 // If a connection does not receive anything for this long and it has timed out |
| 54 // dead. | 54 // on writing, it will be deleted. |
| 55 const uint32 DEAD_CONNECTION_RECEIVE_TIMEOUT = 30 * 1000; // 30 seconds. | 55 const uint32 DEAD_CONNECTION_RECEIVE_TIMEOUT = 10 * 1000; // 10 seconds. |
|
pthatcher1
2015/09/28 23:07:28
I think there are actually two different things he
honghaiz3
2015/09/29 18:47:50
Done.
| |
| 56 | 56 |
| 57 // The timeout duration when a connection does not receive anything. | 57 // The timeout duration when a connection does not receive anything. |
| 58 const uint32 WEAK_CONNECTION_RECEIVE_TIMEOUT = 2500; // 2.5 seconds | 58 const uint32 WEAK_CONNECTION_RECEIVE_TIMEOUT = 2500; // 2.5 seconds |
| 59 | 59 |
| 60 // The length of time we wait before timing out writability on a connection. | 60 // The length of time we wait before timing out writability on a connection. |
| 61 const uint32 CONNECTION_WRITE_TIMEOUT = 15 * 1000; // 15 seconds | 61 const uint32 CONNECTION_WRITE_TIMEOUT = 15 * 1000; // 15 seconds |
| 62 | 62 |
| 63 // The length of time we wait before we become unwritable. | 63 // The length of time we wait before we become unwritable. |
| 64 const uint32 CONNECTION_WRITE_CONNECT_TIMEOUT = 5 * 1000; // 5 seconds | 64 const uint32 CONNECTION_WRITE_CONNECT_TIMEOUT = 5 * 1000; // 5 seconds |
| 65 | 65 |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 566 void OnConnectionRequestTimeout(ConnectionRequest* req); | 566 void OnConnectionRequestTimeout(ConnectionRequest* req); |
| 567 void OnConnectionRequestSent(ConnectionRequest* req); | 567 void OnConnectionRequestSent(ConnectionRequest* req); |
| 568 | 568 |
| 569 // Changes the state and signals if necessary. | 569 // Changes the state and signals if necessary. |
| 570 void set_write_state(WriteState value); | 570 void set_write_state(WriteState value); |
| 571 void set_receiving(bool value); | 571 void set_receiving(bool value); |
| 572 void set_state(State state); | 572 void set_state(State state); |
| 573 void set_connected(bool value); | 573 void set_connected(bool value); |
| 574 | 574 |
| 575 // Checks if this connection is useless, and hence, should be destroyed. | 575 // Checks if this connection is useless, and hence, should be destroyed. |
| 576 void CheckTimeout(); | 576 void CheckTimeout(uint32 now); |
| 577 | 577 |
| 578 void OnMessage(rtc::Message *pmsg); | 578 void OnMessage(rtc::Message *pmsg); |
| 579 | 579 |
| 580 Port* port_; | 580 Port* port_; |
| 581 size_t local_candidate_index_; | 581 size_t local_candidate_index_; |
| 582 Candidate remote_candidate_; | 582 Candidate remote_candidate_; |
| 583 WriteState write_state_; | 583 WriteState write_state_; |
| 584 bool receiving_; | 584 bool receiving_; |
| 585 bool connected_; | 585 bool connected_; |
| 586 bool pruned_; | 586 bool pruned_; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 608 uint32 sent_packets_total_; | 608 uint32 sent_packets_total_; |
| 609 | 609 |
| 610 private: | 610 private: |
| 611 void MaybeAddPrflxCandidate(ConnectionRequest* request, | 611 void MaybeAddPrflxCandidate(ConnectionRequest* request, |
| 612 StunMessage* response); | 612 StunMessage* response); |
| 613 | 613 |
| 614 bool reported_; | 614 bool reported_; |
| 615 State state_; | 615 State state_; |
| 616 // Time duration to switch from receiving to not receiving. | 616 // Time duration to switch from receiving to not receiving. |
| 617 uint32 receiving_timeout_; | 617 uint32 receiving_timeout_; |
| 618 uint32 time_created_ms_; | |
| 618 | 619 |
| 619 friend class Port; | 620 friend class Port; |
| 620 friend class ConnectionRequest; | 621 friend class ConnectionRequest; |
| 621 }; | 622 }; |
| 622 | 623 |
| 623 // ProxyConnection defers all the interesting work to the port | 624 // ProxyConnection defers all the interesting work to the port |
| 624 class ProxyConnection : public Connection { | 625 class ProxyConnection : public Connection { |
| 625 public: | 626 public: |
| 626 ProxyConnection(Port* port, size_t index, const Candidate& candidate); | 627 ProxyConnection(Port* port, size_t index, const Candidate& candidate); |
| 627 | 628 |
| 628 virtual int Send(const void* data, size_t size, | 629 virtual int Send(const void* data, size_t size, |
| 629 const rtc::PacketOptions& options); | 630 const rtc::PacketOptions& options); |
| 630 virtual int GetError() { return error_; } | 631 virtual int GetError() { return error_; } |
| 631 | 632 |
| 632 private: | 633 private: |
| 633 int error_; | 634 int error_; |
| 634 }; | 635 }; |
| 635 | 636 |
| 636 } // namespace cricket | 637 } // namespace cricket |
| 637 | 638 |
| 638 #endif // WEBRTC_P2P_BASE_PORT_H_ | 639 #endif // WEBRTC_P2P_BASE_PORT_H_ |
| OLD | NEW |