openslp/openslp.tcplocal.diff

43 lines
1.5 KiB
Diff
Raw Normal View History

--- ./libslp/libslp_network.c.orig 2014-02-19 15:35:26.360950576 +0000
+++ ./libslp/libslp_network.c 2014-02-19 15:42:20.062949844 +0000
@@ -370,6 +370,8 @@ static int NetworkGetMcastAddrs(const ch
sockfd_t NetworkConnectToSlpd(void * peeraddr)
{
sockfd_t sock = SLP_INVALID_SOCKET;
+ int maxwait = SLPPropertyAsInteger("net.slp.DADiscoveryMaximumWait");
+ struct timeval timeout;
/*Note that these don't actually test the connection to slpd.
They don't have to, since all code that calls this function eventually
@@ -378,14 +380,30 @@ sockfd_t NetworkConnectToSlpd(void * pee
if (SLPNetIsIPV6())
if (!SLPNetSetAddr(peeraddr, AF_INET6, (uint16_t)SLPPropertyAsInteger("net.slp.port"),
&slp_in6addr_loopback))
+ {
+#if 0
sock = SLPNetworkCreateDatagram(AF_INET6);
+#else
+ timeout.tv_sec = maxwait / 1000;
+ timeout.tv_usec = (maxwait % 1000) * 1000;
+ sock = SLPNetworkConnectStream(peeraddr, &timeout);
+#endif
+ }
if (sock == SLP_INVALID_SOCKET && SLPNetIsIPV4())
{
int tempAddr = INADDR_LOOPBACK;
if (SLPNetSetAddr(peeraddr, AF_INET,
(uint16_t)SLPPropertyAsInteger("net.slp.port"), &tempAddr) == 0)
+ {
+#if 0
sock = SLPNetworkCreateDatagram(AF_INET);
+#else
+ timeout.tv_sec = maxwait / 1000;
+ timeout.tv_usec = (maxwait % 1000) * 1000;
+ sock = SLPNetworkConnectStream(peeraddr, &timeout);
+#endif
+ }
}
return sock;
}