Index: webrtc/p2p/base/rawtransportchannel.cc |
diff --git a/webrtc/p2p/base/rawtransportchannel.cc b/webrtc/p2p/base/rawtransportchannel.cc |
index b032e63cdae2c18c8b7217d5bd7c33a134308d61..182857818e81e71622b268a287c9cd332cb87d58 100644 |
--- a/webrtc/p2p/base/rawtransportchannel.cc |
+++ b/webrtc/p2p/base/rawtransportchannel.cc |
@@ -22,31 +22,20 @@ |
#if defined(FEATURE_ENABLE_PSTN) |
-namespace { |
- |
-const uint32 MSG_DESTROY_RTC_UNUSED_PORTS = 1; |
- |
-} // namespace |
- |
namespace cricket { |
RawTransportChannel::RawTransportChannel(const std::string& content_name, |
int component, |
RawTransport* transport, |
- rtc::Thread *worker_thread, |
- PortAllocator *allocator) |
- : TransportChannelImpl(content_name, component), |
- raw_transport_(transport), |
- allocator_(allocator), |
- allocator_session_(NULL), |
- stun_port_(NULL), |
- relay_port_(NULL), |
- port_(NULL), |
- use_relay_(false) { |
- if (worker_thread == NULL) |
- worker_thread_ = raw_transport_->worker_thread(); |
- else |
- worker_thread_ = worker_thread; |
+ PortAllocator* allocator) |
+ : TransportChannelImpl(content_name, component), |
+ raw_transport_(transport), |
+ allocator_(allocator), |
+ allocator_session_(NULL), |
+ stun_port_(NULL), |
+ relay_port_(NULL), |
+ port_(NULL), |
+ use_relay_(false) { |
} |
RawTransportChannel::~RawTransportChannel() { |
@@ -158,7 +147,8 @@ void RawTransportChannel::OnPortReady( |
} |
void RawTransportChannel::OnCandidatesReady( |
- PortAllocatorSession *session, const std::vector<Candidate>& candidates) { |
+ PortAllocatorSession* session, |
+ const std::vector<Candidate>& candidates) { |
ASSERT(session == allocator_session_); |
ASSERT(candidates.size() >= 1); |
@@ -207,14 +197,13 @@ void RawTransportChannel::SetPort(PortInterface* port) { |
// We don't need any ports other than the one we picked. |
allocator_session_->StopGettingPorts(); |
- worker_thread_->Post( |
- this, MSG_DESTROY_RTC_UNUSED_PORTS, NULL); |
+ DestroyUnusedPorts(); |
// Send a message to the other client containing our address. |
ASSERT(port_->Candidates().size() >= 1); |
ASSERT(port_->Candidates()[0].protocol() == "udp"); |
- SignalCandidateReady(this, port_->Candidates()[0]); |
+ SignalCandidateGathered(this, port_->Candidates()[0]); |
// Read all packets from this port. |
port_->EnablePortPackets(); |
@@ -243,8 +232,7 @@ void RawTransportChannel::OnReadPacket( |
SignalReadPacket(this, data, size, rtc::CreatePacketTime(0), 0); |
} |
-void RawTransportChannel::OnMessage(rtc::Message* msg) { |
- ASSERT(msg->message_id == MSG_DESTROY_RTC_UNUSED_PORTS); |
+void RawTransportChannel::DestroyUnusedPorts() { |
ASSERT(port_ != NULL); |
if (port_ != stun_port_) { |
stun_port_->Destroy(); |