| Index: webrtc/p2p/base/basicpacketsocketfactory.cc
|
| diff --git a/webrtc/p2p/base/basicpacketsocketfactory.cc b/webrtc/p2p/base/basicpacketsocketfactory.cc
|
| index 697518da9d0508cfcec888306b133514307726c7..e3c558783826ce9eba8d0abd999763c96f7ac7bb 100644
|
| --- a/webrtc/p2p/base/basicpacketsocketfactory.cc
|
| +++ b/webrtc/p2p/base/basicpacketsocketfactory.cc
|
| @@ -16,6 +16,7 @@
|
| #include "webrtc/base/asyncudpsocket.h"
|
| #include "webrtc/base/logging.h"
|
| #include "webrtc/base/nethelpers.h"
|
| +#include "webrtc/base/network.h"
|
| #include "webrtc/base/physicalsocketserver.h"
|
| #include "webrtc/base/scoped_ptr.h"
|
| #include "webrtc/base/socketadapters.h"
|
| @@ -47,6 +48,14 @@ AsyncPacketSocket* BasicPacketSocketFactory::CreateUdpSocket(
|
| const SocketAddress& address,
|
| uint16_t min_port,
|
| uint16_t max_port) {
|
| + return CreateUdpSocketOnNetwork(address, min_port, max_port, nullptr);
|
| +}
|
| +
|
| +AsyncPacketSocket* BasicPacketSocketFactory::CreateUdpSocketOnNetwork(
|
| + const SocketAddress& address,
|
| + uint16_t min_port,
|
| + uint16_t max_port,
|
| + const Network* network) {
|
| // UDP sockets are simple.
|
| rtc::AsyncSocket* socket =
|
| socket_factory()->CreateAsyncSocket(
|
| @@ -54,6 +63,12 @@ AsyncPacketSocket* BasicPacketSocketFactory::CreateUdpSocket(
|
| if (!socket) {
|
| return NULL;
|
| }
|
| + if (network && network->IsHandleValid()) {
|
| + int res = socket->BindToNetwork(network->handle());
|
| + if (res < 0) {
|
| + LOG(LS_WARNING) << "Network bind failed with error " << res;
|
| + }
|
| + }
|
| if (BindSocket(socket, address, min_port, max_port) < 0) {
|
| LOG(LS_ERROR) << "UDP bind failed with error "
|
| << socket->GetError();
|
|
|