| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // Checks that the next packet has the given contents. Returns the remote | 70 // Checks that the next packet has the given contents. Returns the remote |
| 71 // address that the packet was sent from. | 71 // address that the packet was sent from. |
| 72 bool CheckNextPacket(const char* buf, size_t len, SocketAddress* addr); | 72 bool CheckNextPacket(const char* buf, size_t len, SocketAddress* addr); |
| 73 | 73 |
| 74 // Checks that no packets have arrived or will arrive in the next second. | 74 // Checks that no packets have arrived or will arrive in the next second. |
| 75 bool CheckNoPacket(); | 75 bool CheckNoPacket(); |
| 76 | 76 |
| 77 int GetError(); | 77 int GetError(); |
| 78 int SetOption(Socket::Option opt, int value); | 78 int SetOption(Socket::Option opt, int value); |
| 79 | 79 |
| 80 bool ready_to_send() const; | 80 bool ready_to_send() const { return ready_to_send_count() > 0; } |
| 81 |
| 82 // How many times SignalReadyToSend has been fired. |
| 83 int ready_to_send_count() const { return ready_to_send_count_; } |
| 81 | 84 |
| 82 private: | 85 private: |
| 83 // Timeout for reads when no packet is expected. | 86 // Timeout for reads when no packet is expected. |
| 84 static const int kNoPacketTimeoutMs = 1000; | 87 static const int kNoPacketTimeoutMs = 1000; |
| 85 // Workaround for the fact that AsyncPacketSocket::GetConnState doesn't exist. | 88 // Workaround for the fact that AsyncPacketSocket::GetConnState doesn't exist. |
| 86 Socket::ConnState GetState(); | 89 Socket::ConnState GetState(); |
| 87 // Slot for packets read on the socket. | 90 // Slot for packets read on the socket. |
| 88 void OnPacket(AsyncPacketSocket* socket, const char* buf, size_t len, | 91 void OnPacket(AsyncPacketSocket* socket, const char* buf, size_t len, |
| 89 const SocketAddress& remote_addr, | 92 const SocketAddress& remote_addr, |
| 90 const PacketTime& packet_time); | 93 const PacketTime& packet_time); |
| 91 void OnReadyToSend(AsyncPacketSocket* socket); | 94 void OnReadyToSend(AsyncPacketSocket* socket); |
| 92 bool CheckTimestamp(int64_t packet_timestamp); | 95 bool CheckTimestamp(int64_t packet_timestamp); |
| 93 | 96 |
| 94 CriticalSection crit_; | 97 CriticalSection crit_; |
| 95 AsyncPacketSocket* socket_; | 98 AsyncPacketSocket* socket_; |
| 96 std::vector<Packet*>* packets_; | 99 std::vector<Packet*>* packets_; |
| 97 bool ready_to_send_; | 100 int ready_to_send_count_ = 0; |
| 98 int64_t prev_packet_timestamp_; | 101 int64_t prev_packet_timestamp_; |
| 99 RTC_DISALLOW_COPY_AND_ASSIGN(TestClient); | 102 RTC_DISALLOW_COPY_AND_ASSIGN(TestClient); |
| 100 }; | 103 }; |
| 101 | 104 |
| 102 } // namespace rtc | 105 } // namespace rtc |
| 103 | 106 |
| 104 #endif // WEBRTC_BASE_TESTCLIENT_H_ | 107 #endif // WEBRTC_BASE_TESTCLIENT_H_ |
| OLD | NEW |