summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/UdpTransceiver.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2008-05-21 17:11:04 +0800
committerMatthew Newhook <matthew@zeroc.com>2008-05-21 17:11:04 +0800
commit06e20672108324fa9c2bc688aa9cfca1a586b200 (patch)
tree6bf6164f18dc7f20c638824e965d12aaab57dbf6 /cpp/src/Ice/UdpTransceiver.cpp
parenthttp://bugzilla/bugzilla/show_bug.cgi?id=3216 - mcastServer not initialized. (diff)
downloadice-06e20672108324fa9c2bc688aa9cfca1a586b200.tar.bz2
ice-06e20672108324fa9c2bc688aa9cfca1a586b200.tar.xz
ice-06e20672108324fa9c2bc688aa9cfca1a586b200.zip
Some cleanup of the networking code.
Diffstat (limited to 'cpp/src/Ice/UdpTransceiver.cpp')
-rw-r--r--cpp/src/Ice/UdpTransceiver.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/cpp/src/Ice/UdpTransceiver.cpp b/cpp/src/Ice/UdpTransceiver.cpp
index 66168b1779c..830a14b575c 100644
--- a/cpp/src/Ice/UdpTransceiver.cpp
+++ b/cpp/src/Ice/UdpTransceiver.cpp
@@ -341,13 +341,13 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
_logger(instance->initializationData().logger),
_stats(instance->initializationData().stats),
_incoming(true),
- _mcastServer(false),
+ _addr(getAddressForServer(host, port, instance->protocolSupport())),
+ _mcastServer(isMulticast(_addr)),
_connect(connect),
_warn(instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Datagrams") > 0)
{
try
{
- getAddressForServer(host, port, _addr, instance->protocolSupport());
_fd = createSocket(true, _addr.ss_family);
setBufSize(instance);
setBlock(_fd, false);
@@ -367,13 +367,12 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
// so we bind to INADDR_ANY (0.0.0.0) instead.
//
struct sockaddr_storage addr;
- getAddressForServer("", getPort(_addr), addr, _addr.ss_family == AF_INET ? EnableIPv4 : EnableIPv6);
+ addr = getAddressForServer("", getPort(_addr), _addr.ss_family == AF_INET ? EnableIPv4 : EnableIPv6);
doBind(_fd, addr);
#else
- doBind(_fd, _addr);
+ doBind(_fd, const_cast<struct sockaddr_storage&>(_addr));
#endif
setMcastGroup(_fd, _addr, mcastInterface);
- _mcastServer = true;
}
else
{
@@ -392,7 +391,7 @@ IceInternal::UdpTransceiver::UdpTransceiver(const InstancePtr& instance, const s
//
setReuseAddress(_fd, true);
#endif
- doBind(_fd, _addr);
+ doBind(_fd, const_cast<struct sockaddr_storage&>(_addr));
}
if(_traceLevels->network >= 1)