OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 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 17 matching lines...) Expand all Loading... |
28 public: | 28 public: |
29 explicit Socket(rtc::AsyncSocket* socket) : socket_(socket) { | 29 explicit Socket(rtc::AsyncSocket* socket) : socket_(socket) { |
30 socket_->SignalReadEvent.connect(this, &Socket::OnReadEvent); | 30 socket_->SignalReadEvent.connect(this, &Socket::OnReadEvent); |
31 socket_->SignalWriteEvent.connect(this, &Socket::OnWriteEvent); | 31 socket_->SignalWriteEvent.connect(this, &Socket::OnWriteEvent); |
32 } | 32 } |
33 | 33 |
34 int Connect(const rtc::SocketAddress& addr) override { | 34 int Connect(const rtc::SocketAddress& addr) override { |
35 return MapResult(socket_->Connect(addr)); | 35 return MapResult(socket_->Connect(addr)); |
36 } | 36 } |
37 | 37 |
38 int Bind(const rtc::SocketAddress& addr) override { | |
39 return MapResult(socket_->Bind(addr)); | |
40 } | |
41 | |
42 int SendTo(const rtc::SocketAddress& addr, | 38 int SendTo(const rtc::SocketAddress& addr, |
43 char* buf, | 39 char* buf, |
44 size_t buf_len, | 40 size_t buf_len, |
45 AsyncCallback callback) override { | 41 AsyncCallback callback) override { |
46 write_ = NetworkWrite(addr, buf, buf_len, callback); | 42 write_ = NetworkWrite(addr, buf, buf_len, callback); |
47 return MapResult(socket_->SendTo(buf, buf_len, addr)); | 43 return MapResult(socket_->SendTo(buf, buf_len, addr)); |
48 } | 44 } |
49 | 45 |
50 int RecvFrom(char* buf, | 46 int RecvFrom(char* buf, |
51 size_t buf_len, | 47 size_t buf_len, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 169 |
174 void OnMessage(rtc::Message* msg) { | 170 void OnMessage(rtc::Message* msg) { |
175 rtc::scoped_ptr<CallbackMessageData> callback( | 171 rtc::scoped_ptr<CallbackMessageData> callback( |
176 reinterpret_cast<CallbackMessageData*>(msg->pdata)); | 172 reinterpret_cast<CallbackMessageData*>(msg->pdata)); |
177 callback->callback_(); | 173 callback->callback_(); |
178 } | 174 } |
179 }; | 175 }; |
180 | 176 |
181 } // namespace stunprober | 177 } // namespace stunprober |
182 #endif // WEBRTC_P2P_STUNPROBER_STUNPROBER_DEPENDENCIES_H_ | 178 #endif // WEBRTC_P2P_STUNPROBER_STUNPROBER_DEPENDENCIES_H_ |
OLD | NEW |