diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2014-08-07 12:18:42 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2014-08-07 12:18:42 -0230 |
commit | 232fa424a7339659b6ad2cd02fbfe89420457601 (patch) | |
tree | 978d9e9286c2915b771f8bea019276ab216eecc4 /cpp/src/Ice/TcpTransceiver.cpp | |
parent | Windows SSL SChannel implementation & OS X Secure Transport fixes. (diff) | |
download | ice-232fa424a7339659b6ad2cd02fbfe89420457601.tar.bz2 ice-232fa424a7339659b6ad2cd02fbfe89420457601.tar.xz ice-232fa424a7339659b6ad2cd02fbfe89420457601.zip |
ICE-5457 added ability to set source address for connections
Diffstat (limited to 'cpp/src/Ice/TcpTransceiver.cpp')
-rw-r--r-- | cpp/src/Ice/TcpTransceiver.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/cpp/src/Ice/TcpTransceiver.cpp b/cpp/src/Ice/TcpTransceiver.cpp index f5c30d11457..4c8be1b2f28 100644 --- a/cpp/src/Ice/TcpTransceiver.cpp +++ b/cpp/src/Ice/TcpTransceiver.cpp @@ -334,7 +334,7 @@ IceInternal::TcpTransceiver::read(Buffer& buf, bool&) if(_instance->traceLevel() >= 3) { Trace out(_instance->logger(), _instance->traceCategory()); - out << "received " << ret << " of " << packetSize << " bytes via " << _instance->protocol() << '\n' + out << "received " << ret << " of " << packetSize << " bytes via " << _instance->protocol() << '\n' << toString(); } @@ -352,7 +352,7 @@ IceInternal::TcpTransceiver::startWrite(Buffer& buf) if(_state == StateConnectPending) { Address addr = _proxy ? _proxy->getAddress() : _addr; - doConnectAsync(_fd, addr, _write); + doConnectAsync(_fd, addr, _sourceAddr, _write); return false; } @@ -423,7 +423,7 @@ IceInternal::TcpTransceiver::finishWrite(Buffer& buf) } Trace out(_instance->logger(), _instance->traceCategory()); - out << "sent " << _write.count << " of " << packetSize << " bytes via " << _instance->protocol() << '\n' + out << "sent " << _write.count << " of " << packetSize << " bytes via " << _instance->protocol() << '\n' << toString(); } @@ -497,7 +497,7 @@ IceInternal::TcpTransceiver::finishRead(Buffer& buf, bool&) packetSize = _maxReceivePacketSize; } Trace out(_instance->logger(), _instance->traceCategory()); - out << "received " << _read.count << " of " << packetSize << " bytes via " << _instance->protocol() << '\n' + out << "received " << _read.count << " of " << packetSize << " bytes via " << _instance->protocol() << '\n' << toString(); } @@ -534,12 +534,14 @@ IceInternal::TcpTransceiver::checkSendSize(const Buffer& buf, size_t messageSize } } -IceInternal::TcpTransceiver::TcpTransceiver(const ProtocolInstancePtr& instance, SOCKET fd, - const NetworkProxyPtr& proxy, const Address& addr) : +IceInternal::TcpTransceiver::TcpTransceiver(const ProtocolInstancePtr& instance, SOCKET fd, + const NetworkProxyPtr& proxy, const Address& addr, + const Address& sourceAddr) : NativeInfo(fd), _instance(instance), _proxy(proxy), _addr(addr), + _sourceAddr(sourceAddr), _state(StateNeedConnect) #ifdef ICE_USE_IOCP , _read(SocketOperationRead), @@ -574,6 +576,7 @@ IceInternal::TcpTransceiver::TcpTransceiver(const ProtocolInstancePtr& instance, NativeInfo(fd), _instance(instance), _addr(Address()), + _sourceAddr(getInvalidAddress()), _state(StateConnected), _desc(fdToString(_fd)) #ifdef ICE_USE_IOCP @@ -617,7 +620,7 @@ IceInternal::TcpTransceiver::connect() try { Address addr = _proxy ? _proxy->getAddress() : _addr; - if(doConnect(_fd, addr)) + if(doConnect(_fd, addr, _sourceAddr)) { _state = StateConnected; _desc = fdToString(_fd, _proxy, _addr, true); |