Make multiple SSDP advertisements faster.
Put the loop to send multiple copies of each SSDP advertisements in ssdp_server.c instead of ssdp_device.c so we have only one call to imillisleep ( SSDP_PAUSE ) to speed up advertisements.
This commit is contained in:
parent
2d22e997e1
commit
c65ec8a720
@ -2,6 +2,14 @@
|
||||
Version 1.6.9
|
||||
*******************************************************************************
|
||||
|
||||
2010-11-08 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
|
||||
|
||||
Make multiple SSDP advertisements faster.
|
||||
|
||||
Put the loop to send multiple copies of each SSDP advertisements in
|
||||
ssdp_server.c instead of ssdp_device.c so we have only one call to
|
||||
imillisleep ( SSDP_PAUSE ) to speed up advertisements.
|
||||
|
||||
2010-11-05 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
|
||||
|
||||
Removing unused NUM_COPY variable.
|
||||
|
@ -535,8 +535,6 @@ DeviceAdvertisement( IN char *DevType,
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
}
|
||||
// send packets
|
||||
int NumCopy = 0;
|
||||
while( ret_code == UPNP_E_SUCCESS && NumCopy < NUM_SSDP_COPY ) {
|
||||
if( RootDev ) {
|
||||
// send 3 msg types
|
||||
ret_code = NewRequestHandler( (struct sockaddr*)&__ss, 3, &msgs[0] );
|
||||
@ -545,9 +543,6 @@ DeviceAdvertisement( IN char *DevType,
|
||||
// send 2 msg types
|
||||
ret_code = NewRequestHandler( (struct sockaddr*)&__ss, 2, &msgs[1] );
|
||||
}
|
||||
NumCopy++;
|
||||
imillisleep(SSDP_PAUSE);
|
||||
}
|
||||
|
||||
// free msgs
|
||||
free( msgs[0] );
|
||||
@ -769,12 +764,7 @@ ServiceAdvertisement( IN char *Udn,
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
}
|
||||
|
||||
int NumCopy = 0;
|
||||
while( RetVal == UPNP_E_SUCCESS && NumCopy < NUM_SSDP_COPY ) {
|
||||
RetVal = NewRequestHandler( (struct sockaddr*)&__ss, 1, szReq );
|
||||
NumCopy++;
|
||||
imillisleep(SSDP_PAUSE);
|
||||
}
|
||||
|
||||
free( szReq[0] );
|
||||
return RetVal;
|
||||
@ -879,12 +869,7 @@ ServiceShutdown( IN char *Udn,
|
||||
if( szReq[0] == NULL ) {
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
}
|
||||
int NumCopy = 0;
|
||||
while( RetVal == UPNP_E_SUCCESS && NumCopy < NUM_SSDP_COPY ) {
|
||||
RetVal = NewRequestHandler( (struct sockaddr*)&__ss, 1, szReq );
|
||||
NumCopy++;
|
||||
imillisleep(SSDP_PAUSE);
|
||||
}
|
||||
|
||||
free( szReq[0] );
|
||||
return RetVal;
|
||||
@ -971,8 +956,6 @@ DeviceShutdown( IN char *DevType,
|
||||
return UPNP_E_OUTOF_MEMORY;
|
||||
}
|
||||
// send packets
|
||||
int NumCopy = 0;
|
||||
while( ret_code == UPNP_E_SUCCESS && NumCopy < NUM_SSDP_COPY ) {
|
||||
if( RootDev ) {
|
||||
// send 3 msg types
|
||||
ret_code = NewRequestHandler( (struct sockaddr*)&__ss, 3, &msgs[0] );
|
||||
@ -981,9 +964,6 @@ DeviceShutdown( IN char *DevType,
|
||||
// send 2 msg types
|
||||
ret_code = NewRequestHandler( (struct sockaddr*)&__ss, 2, &msgs[1] );
|
||||
}
|
||||
NumCopy++;
|
||||
imillisleep(SSDP_PAUSE);
|
||||
}
|
||||
|
||||
// free msgs
|
||||
free( msgs[0] );
|
||||
|
@ -135,6 +135,7 @@ int AdvertiseAndReply(
|
||||
const DOMString tmpStr;
|
||||
char SERVER[200];
|
||||
const DOMString dbgStr;
|
||||
int NumCopy = 0;
|
||||
|
||||
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Inside AdvertiseAndReply with AdFlag = %d\n", AdFlag);
|
||||
@ -152,6 +153,11 @@ int AdvertiseAndReply(
|
||||
get_sdk_info(SERVER);
|
||||
|
||||
/* parse the device list and send advertisements/replies */
|
||||
while (NumCopy == 0 || (AdFlag && NumCopy < NUM_SSDP_COPY)) {
|
||||
if (NumCopy != 0)
|
||||
imillisleep(SSDP_PAUSE);
|
||||
NumCopy++;
|
||||
|
||||
for (i = 0;; i++) {
|
||||
UpnpPrintf(UPNP_ALL, API, __FILE__, __LINE__,
|
||||
"Entering new device list with i = %d\n\n", i);
|
||||
@ -392,6 +398,7 @@ int AdvertiseAndReply(
|
||||
ixmlNodeList_free(nodeList);
|
||||
nodeList = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
end_function:
|
||||
ixmlNodeList_free(tmpNodeList);
|
||||
|
Loading…
Reference in New Issue
Block a user