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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 } | 377 } |
378 *value = it->second; | 378 *value = it->second; |
379 return 0; // 0 is success to emulate getsockopt() | 379 return 0; // 0 is success to emulate getsockopt() |
380 } | 380 } |
381 | 381 |
382 int VirtualSocket::SetOption(Option opt, int value) { | 382 int VirtualSocket::SetOption(Option opt, int value) { |
383 options_map_[opt] = value; | 383 options_map_[opt] = value; |
384 return 0; // 0 is success to emulate setsockopt() | 384 return 0; // 0 is success to emulate setsockopt() |
385 } | 385 } |
386 | 386 |
387 int VirtualSocket::EstimateMTU(uint16_t* mtu) { | |
388 if (CS_CONNECTED != state_) | |
389 return ENOTCONN; | |
390 else | |
391 return 65536; | |
392 } | |
393 | |
394 void VirtualSocket::OnMessage(Message* pmsg) { | 387 void VirtualSocket::OnMessage(Message* pmsg) { |
395 if (pmsg->message_id == MSG_ID_PACKET) { | 388 if (pmsg->message_id == MSG_ID_PACKET) { |
396 RTC_DCHECK(nullptr != pmsg->pdata); | 389 RTC_DCHECK(nullptr != pmsg->pdata); |
397 Packet* packet = static_cast<Packet*>(pmsg->pdata); | 390 Packet* packet = static_cast<Packet*>(pmsg->pdata); |
398 | 391 |
399 recv_buffer_.push_back(packet); | 392 recv_buffer_.push_back(packet); |
400 | 393 |
401 if (async_) { | 394 if (async_) { |
402 SignalReadEvent(this); | 395 SignalReadEvent(this); |
403 } | 396 } |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 void VirtualSocketServer::SetDefaultRoute(const IPAddress& from_addr) { | 1183 void VirtualSocketServer::SetDefaultRoute(const IPAddress& from_addr) { |
1191 RTC_DCHECK(!IPIsAny(from_addr)); | 1184 RTC_DCHECK(!IPIsAny(from_addr)); |
1192 if (from_addr.family() == AF_INET) { | 1185 if (from_addr.family() == AF_INET) { |
1193 default_route_v4_ = from_addr; | 1186 default_route_v4_ = from_addr; |
1194 } else if (from_addr.family() == AF_INET6) { | 1187 } else if (from_addr.family() == AF_INET6) { |
1195 default_route_v6_ = from_addr; | 1188 default_route_v6_ = from_addr; |
1196 } | 1189 } |
1197 } | 1190 } |
1198 | 1191 |
1199 } // namespace rtc | 1192 } // namespace rtc |
OLD | NEW |