mirror of https://github.com/aria2/aria2
2010-03-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
For LPD sockets, bind IN_ADDRANY because binding multicast address fails under Windows. * src/LpdMessageReceiver.cc * test/LpdMessageDispatcherTest.ccpull/1/head
parent
22308b3ac9
commit
91b7b721ea
|
@ -1,3 +1,10 @@
|
||||||
|
2010-03-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
For LPD sockets, bind IN_ADDRANY because binding multicast address
|
||||||
|
fails under Windows.
|
||||||
|
* src/LpdMessageReceiver.cc
|
||||||
|
* test/LpdMessageDispatcherTest.cc
|
||||||
|
|
||||||
2010-03-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-03-09 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed the bug that error message is not propagated to Exception.
|
Fixed the bug that error message is not propagated to Exception.
|
||||||
|
|
|
@ -52,7 +52,12 @@ bool LpdMessageReceiver::init(const std::string& localAddr)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
_socket.reset(new SocketCore(SOCK_DGRAM));
|
_socket.reset(new SocketCore(SOCK_DGRAM));
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
// Binding multicast address fails under Windows.
|
||||||
|
_socket->bindWithFamily(_multicastPort, AF_INET);
|
||||||
|
#else // !__MINGW32__
|
||||||
_socket->bind(_multicastAddress, _multicastPort);
|
_socket->bind(_multicastAddress, _multicastPort);
|
||||||
|
#endif // !__MINGW32__
|
||||||
if(_logger->debug()) {
|
if(_logger->debug()) {
|
||||||
_logger->debug("Joining multicast group. %s:%u, localAddr=%s",
|
_logger->debug("Joining multicast group. %s:%u, localAddr=%s",
|
||||||
_multicastAddress.c_str(), _multicastPort,
|
_multicastAddress.c_str(), _multicastPort,
|
||||||
|
|
|
@ -43,7 +43,11 @@ void LpdMessageDispatcherTest::testCreateLpdRequest()
|
||||||
void LpdMessageDispatcherTest::testSendMessage()
|
void LpdMessageDispatcherTest::testSendMessage()
|
||||||
{
|
{
|
||||||
SharedHandle<SocketCore> recvsock(new SocketCore(SOCK_DGRAM));
|
SharedHandle<SocketCore> recvsock(new SocketCore(SOCK_DGRAM));
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
recvsock->bindWithFamily(LPD_MULTICAST_PORT, AF_INET);
|
||||||
|
#else // !__MINGW32__
|
||||||
recvsock->bind(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
|
recvsock->bind(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
|
||||||
|
#endif // !__MINGW32__
|
||||||
recvsock->joinMulticastGroup(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT, "");
|
recvsock->joinMulticastGroup(LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT, "");
|
||||||
|
|
||||||
LpdMessageDispatcher d("cd41c7fdddfd034a15a04d7ff881216e01c4ceaf", 6000,
|
LpdMessageDispatcher d("cd41c7fdddfd034a15a04d7ff881216e01c4ceaf", 6000,
|
||||||
|
|
Loading…
Reference in New Issue