| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 423       int error = (CS_CONNECTING == state_) ? ECONNREFUSED : 0; | 423       int error = (CS_CONNECTING == state_) ? ECONNREFUSED : 0; | 
| 424       state_ = CS_CLOSED; | 424       state_ = CS_CLOSED; | 
| 425       remote_addr_.Clear(); | 425       remote_addr_.Clear(); | 
| 426       if (async_) { | 426       if (async_) { | 
| 427         SignalCloseEvent(this, error); | 427         SignalCloseEvent(this, error); | 
| 428       } | 428       } | 
| 429     } | 429     } | 
| 430   } else if (pmsg->message_id == MSG_ID_ADDRESS_BOUND) { | 430   } else if (pmsg->message_id == MSG_ID_ADDRESS_BOUND) { | 
| 431     SignalAddressReady(this, GetLocalAddress()); | 431     SignalAddressReady(this, GetLocalAddress()); | 
| 432   } else { | 432   } else { | 
| 433     RTC_DCHECK(false); | 433     RTC_NOTREACHED(); | 
| 434   } | 434   } | 
| 435 } | 435 } | 
| 436 | 436 | 
| 437 int VirtualSocket::InitiateConnect(const SocketAddress& addr, bool use_delay) { | 437 int VirtualSocket::InitiateConnect(const SocketAddress& addr, bool use_delay) { | 
| 438   if (!remote_addr_.IsNil()) { | 438   if (!remote_addr_.IsNil()) { | 
| 439     error_ = (CS_CONNECTED == state_) ? EISCONN : EINPROGRESS; | 439     error_ = (CS_CONNECTED == state_) ? EISCONN : EINPROGRESS; | 
| 440     return -1; | 440     return -1; | 
| 441   } | 441   } | 
| 442   if (local_addr_.IsNil()) { | 442   if (local_addr_.IsNil()) { | 
| 443     // If there's no local address set, grab a random one in the correct AF. | 443     // If there's no local address set, grab a random one in the correct AF. | 
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 682   AddressMap::value_type entry(normalized, socket); | 682   AddressMap::value_type entry(normalized, socket); | 
| 683   return bindings_->insert(entry).second ? 0 : -1; | 683   return bindings_->insert(entry).second ? 0 : -1; | 
| 684 } | 684 } | 
| 685 | 685 | 
| 686 int VirtualSocketServer::Bind(VirtualSocket* socket, SocketAddress* addr) { | 686 int VirtualSocketServer::Bind(VirtualSocket* socket, SocketAddress* addr) { | 
| 687   RTC_DCHECK(NULL != socket); | 687   RTC_DCHECK(NULL != socket); | 
| 688 | 688 | 
| 689   if (!IPIsUnspec(addr->ipaddr())) { | 689   if (!IPIsUnspec(addr->ipaddr())) { | 
| 690     addr->SetIP(addr->ipaddr().Normalized()); | 690     addr->SetIP(addr->ipaddr().Normalized()); | 
| 691   } else { | 691   } else { | 
| 692     RTC_DCHECK(false); | 692     RTC_NOTREACHED(); | 
| 693   } | 693   } | 
| 694 | 694 | 
| 695   if (addr->port() == 0) { | 695   if (addr->port() == 0) { | 
| 696     for (int i = 0; i < kEphemeralPortCount; ++i) { | 696     for (int i = 0; i < kEphemeralPortCount; ++i) { | 
| 697       addr->SetPort(GetNextPort()); | 697       addr->SetPort(GetNextPort()); | 
| 698       if (bindings_->find(*addr) == bindings_->end()) { | 698       if (bindings_->find(*addr) == bindings_->end()) { | 
| 699         break; | 699         break; | 
| 700       } | 700       } | 
| 701     } | 701     } | 
| 702   } | 702   } | 
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1191 void VirtualSocketServer::SetDefaultRoute(const IPAddress& from_addr) { | 1191 void VirtualSocketServer::SetDefaultRoute(const IPAddress& from_addr) { | 
| 1192   RTC_DCHECK(!IPIsAny(from_addr)); | 1192   RTC_DCHECK(!IPIsAny(from_addr)); | 
| 1193   if (from_addr.family() == AF_INET) { | 1193   if (from_addr.family() == AF_INET) { | 
| 1194     default_route_v4_ = from_addr; | 1194     default_route_v4_ = from_addr; | 
| 1195   } else if (from_addr.family() == AF_INET6) { | 1195   } else if (from_addr.family() == AF_INET6) { | 
| 1196     default_route_v6_ = from_addr; | 1196     default_route_v6_ = from_addr; | 
| 1197   } | 1197   } | 
| 1198 } | 1198 } | 
| 1199 | 1199 | 
| 1200 }  // namespace rtc | 1200 }  // namespace rtc | 
| OLD | NEW | 
|---|