openslp/openslp.tcpknownda.diff

95 lines
4.2 KiB
Diff

--- slpd/slpd_knownda.c.orig 2018-12-06 14:03:06.033908426 +0000
+++ slpd/slpd_knownda.c 2018-12-06 14:12:30.448421700 +0000
@@ -261,7 +261,7 @@ void SLPDKnownDARegisterAll(SLPMessage *
/*----------------------------------------------*/
/* Establish a new connection with the known DA */
/*----------------------------------------------*/
- sock = SLPDOutgoingConnect(0, &(daadvert->peer));
+ sock = SLPDOutgoingConnect(1, &(daadvert->peer));
if (sock)
while (1)
{
@@ -294,7 +294,8 @@ void SLPDKnownDARegisterAll(SLPMessage *
/* link newly constructed buffer to socket resendlist, and send */
/*--------------------------------------------------------------*/
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) sendbuf);
- SLPDOutgoingDatagramWrite(sock, sendbuf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
}
}
@@ -433,7 +434,7 @@ void SLPDKnownDADeregisterAll(SLPMessage
return;
/* Establish a new connection with the known DA */
- sock = SLPDOutgoingConnect(0, &(daadvert->peer));
+ sock = SLPDOutgoingConnect(1, &(daadvert->peer));
if (sock)
while (1)
{
@@ -459,7 +460,8 @@ void SLPDKnownDADeregisterAll(SLPMessage
/* link newly constructed buffer to socket resendlist, and send */
/*--------------------------------------------------------------*/
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) sendbuf);
- SLPDOutgoingDatagramWrite(sock, sendbuf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
}
}
@@ -502,14 +504,15 @@ int SLPDKnownDAFromDHCP()
Get an outgoing socket to the DA and set it up to make
the service:directoryagent request
--------------------------------------------------------*/
- sock = SLPDOutgoingConnect(0, &daaddr);
+ sock = SLPDOutgoingConnect(1, &daaddr);
if (sock)
{
buf = 0;
if (MakeActiveDiscoveryRqst(0, &buf) == 0)
{
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) buf);
- SLPDOutgoingDatagramWrite(sock, buf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
}
}
@@ -601,14 +604,15 @@ int SLPKnownDAFromProperties()
/* Get an outgoing socket to the DA and set it up to make */
/* the service:directoryagent request */
/*--------------------------------------------------------*/
- sock = SLPDOutgoingConnect(0, &daaddr);
+ sock = SLPDOutgoingConnect(1, &daaddr);
if (sock)
{
buf = 0;
if (MakeActiveDiscoveryRqst(0, &buf) == 0)
{
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) buf);
- SLPDOutgoingDatagramWrite(sock, buf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
}
}
@@ -1470,14 +1474,15 @@ void SLPDKnownDAEcho(SLPMessage * msg, S
/*------------------------------------------*/
/* Load the socket with the message to send */
/*------------------------------------------*/
- sock = SLPDOutgoingConnect(0, &(entry->msg->peer));
+ sock = SLPDOutgoingConnect(1, &(entry->msg->peer));
if (sock)
{
dup = SLPBufferDup(buf);
if (dup)
{
SLPListLinkTail(&(sock->sendlist), (SLPListItem *) dup);
- SLPDOutgoingDatagramWrite(sock, buf);
+ if (sock->state == STREAM_CONNECT_IDLE)
+ sock->state = STREAM_WRITE_FIRST;
}
else
sock->state = SOCKET_CLOSE;