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 #include <sstream> | 11 #include <sstream> |
12 #include "webrtc/p2p/base/common.h" | 12 #include "webrtc/p2p/base/common.h" |
13 #include "webrtc/p2p/base/transportchannel.h" | 13 #include "webrtc/p2p/base/transportchannel.h" |
14 | 14 |
15 namespace cricket { | 15 namespace cricket { |
16 | 16 |
17 std::string TransportChannel::ToString() const { | 17 std::string TransportChannel::ToString() const { |
18 const char READABLE_ABBREV[2] = { '_', 'R' }; | 18 const char RECEIVING_ABBREV[2] = { '_', 'R' }; |
19 const char WRITABLE_ABBREV[2] = { '_', 'W' }; | 19 const char WRITABLE_ABBREV[2] = { '_', 'W' }; |
20 std::stringstream ss; | 20 std::stringstream ss; |
21 ss << "Channel[" << transport_name_ << "|" << component_ << "|" | 21 ss << "Channel[" << transport_name_ << "|" << component_ << "|" |
22 << READABLE_ABBREV[readable_] << WRITABLE_ABBREV[writable_] << "]"; | 22 << RECEIVING_ABBREV[receiving_] << WRITABLE_ABBREV[writable_] << "]"; |
23 return ss.str(); | 23 return ss.str(); |
24 } | 24 } |
25 | 25 |
26 void TransportChannel::set_readable(bool readable) { | |
27 if (readable_ != readable) { | |
28 readable_ = readable; | |
29 SignalReadableState(this); | |
30 } | |
31 } | |
32 | |
33 void TransportChannel::set_receiving(bool receiving) { | 26 void TransportChannel::set_receiving(bool receiving) { |
34 if (receiving_ == receiving) { | 27 if (receiving_ == receiving) { |
35 return; | 28 return; |
36 } | 29 } |
37 receiving_ = receiving; | 30 receiving_ = receiving; |
38 SignalReceivingState(this); | 31 SignalReceivingState(this); |
39 } | 32 } |
40 | 33 |
41 void TransportChannel::set_writable(bool writable) { | 34 void TransportChannel::set_writable(bool writable) { |
42 if (writable_ != writable) { | 35 if (writable_ != writable) { |
43 LOG_J(LS_VERBOSE, this) << "set_writable from:" << writable_ << " to " | 36 LOG_J(LS_VERBOSE, this) << "set_writable from:" << writable_ << " to " |
44 << writable; | 37 << writable; |
45 writable_ = writable; | 38 writable_ = writable; |
46 if (writable_) { | 39 if (writable_) { |
47 SignalReadyToSend(this); | 40 SignalReadyToSend(this); |
48 } | 41 } |
49 SignalWritableState(this); | 42 SignalWritableState(this); |
50 } | 43 } |
51 } | 44 } |
52 | 45 |
53 } // namespace cricket | 46 } // namespace cricket |
OLD | NEW |