Removing unused NUM_COPY variable.

Previously, NUM_COPY was used in ssdp_device.c to send multiple copies
of each advertisements but also multiple replies to each M-SEARCH
request. As sending multiple replies is not compliant with HTTPU/MU
spec, NUM_COPY has been set to 1 in an older patch. However, as this
variable is not needed and has been replaced with SSDP_COPY, it has
been removed.
(cherry picked from commit 2d22e997e1ff06ad2b202623d73f4d3f321c6131)
This commit is contained in:
Fabrice Fontaine 2010-11-05 17:32:53 +01:00 committed by Marcelo Roberto Jimenez
parent b8b5f6a0ef
commit 56e0fdd438
3 changed files with 24 additions and 33 deletions

View File

@ -221,6 +221,17 @@ Version 1.8.0
Version 1.6.9 Version 1.6.9
******************************************************************************* *******************************************************************************
2010-11-05 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
Removing unused NUM_COPY variable.
Previously, NUM_COPY was used in ssdp_device.c to send multiple copies
of each advertisements but also multiple replies to each M-SEARCH
request. As sending multiple replies is not compliant with HTTPU/MU
spec, NUM_COPY has been set to 1 in an older patch. However, as this
variable is not needed and has been replaced with SSDP_COPY, it has
been removed.
2010-11-05 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com> 2010-11-05 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
Use SSDP_COPY to send multiple SSDP advertisements. Use SSDP_COPY to send multiple SSDP advertisements.

View File

@ -90,7 +90,6 @@ typedef enum SsdpCmdType{
#define SSDP_IPV6_SITELOCAL "FF05::C" #define SSDP_IPV6_SITELOCAL "FF05::C"
#define SSDP_PORT 1900 #define SSDP_PORT 1900
#define NUM_TRY 3 #define NUM_TRY 3
#define NUM_COPY 1
#define THREAD_LIMIT 50 #define THREAD_LIMIT 50
#define COMMAND_LEN 300 #define COMMAND_LEN 300

View File

@ -223,7 +223,6 @@ NewRequestHandler( IN struct sockaddr *DestAddr,
char errorBuffer[ERROR_BUFFER_LEN]; char errorBuffer[ERROR_BUFFER_LEN];
SOCKET ReplySock; SOCKET ReplySock;
int socklen = sizeof( struct sockaddr_storage ); int socklen = sizeof( struct sockaddr_storage );
int NumCopy;
int Index; int Index;
unsigned long replyAddr = inet_addr( gIF_IPV4 ); unsigned long replyAddr = inet_addr( gIF_IPV4 );
int ttl = 4; // a/c to UPNP Spec int ttl = 4; // a/c to UPNP Spec
@ -265,38 +264,20 @@ NewRequestHandler( IN struct sockaddr *DestAddr,
for( Index = 0; Index < NumPacket; Index++ ) { for( Index = 0; Index < NumPacket; Index++ ) {
int rc; int rc;
// The reason to keep this loop is purely historical/documentation, UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
// according to section 9.2 of HTTPU spec: ">>> SSDP SEND to %s >>>\n%s\n",
// buf_ntop, *( RqPacket + Index ) );
// "If a multicast resource would send a response(s) to any copy of the rc = sendto( ReplySock, *( RqPacket + Index ),
// request, it SHOULD send its response(s) to each copy of the request strlen( *( RqPacket + Index ) ),
// it receives. It MUST NOT repeat its response(s) per copy of the 0, DestAddr, socklen );
// request."
// if (rc == -1) {
// http://www.upnp.org/download/draft-goland-http-udp-04.txt strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN);
//
// So, NUM_COPY has been changed from 2 to 1.
NumCopy = 0;
while( NumCopy < NUM_COPY ) {
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__, UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
">>> SSDP SEND to %s >>>\n%s\n", "SSDP_LIB: New Request Handler:"
buf_ntop, *( RqPacket + Index ) ); "Error in socket(): %s\n", errorBuffer );
rc = sendto( ReplySock, *( RqPacket + Index ), ret = UPNP_E_SOCKET_WRITE;
strlen( *( RqPacket + Index ) ), goto end_NewRequestHandler;
0, DestAddr, socklen );
if (rc == -1) {
strerror_r(errno, errorBuffer, ERROR_BUFFER_LEN);
UpnpPrintf( UPNP_INFO, SSDP, __FILE__, __LINE__,
"SSDP_LIB: New Request Handler:"
"Error in socket(): %s\n", errorBuffer );
ret = UPNP_E_SOCKET_WRITE;
goto end_NewRequestHandler;
}
imillisleep( SSDP_PAUSE );
++NumCopy;
} }
} }