Slightly better debug messages and lots of white spaces.
git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@225 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
b29de32110
commit
fd80e5a8ff
@ -475,11 +475,13 @@ http_SendMessage( IN SOCKINFO * info,
|
||||
buf_length = ( size_t ) va_arg( argp, size_t );
|
||||
if( buf_length > 0 ) {
|
||||
num_written = sock_write( info, buf, buf_length, TimeOut );
|
||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
">>> (SENT) >>>\n"
|
||||
"%.*s\nbuf_length=%d, num_written=%d\n"
|
||||
"------------\n",
|
||||
(int)buf_length, buf, (int)buf_length, num_written );
|
||||
if( ( size_t ) num_written != buf_length )
|
||||
goto end;
|
||||
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||
">>> (SENT) >>>\n%.*s\n------------\n",
|
||||
( int )buf_length, buf );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,9 @@ CLIENTONLY( SOCKET gSsdpReqSocket = 0;
|
||||
* Function : AdvertiseAndReply
|
||||
*
|
||||
* Parameters:
|
||||
* IN int AdFlag: -1 = Send shutdown, 0 = send reply,
|
||||
* IN int AdFlag:
|
||||
* -1 = Send shutdown,
|
||||
* 0 = send reply,
|
||||
* 1 = Send Advertisement
|
||||
* IN UpnpDevice_Handle Hnd: Device handle
|
||||
* IN enum SsdpSearchType SearchType:Search type for sending replies
|
||||
@ -819,18 +821,20 @@ readFromSSDPSocket( SOCKET socket )
|
||||
( struct sockaddr * )&clientAddr, &socklen );
|
||||
|
||||
if( byteReceived > 0 ) {
|
||||
|
||||
requestBuf[byteReceived] = '\0';
|
||||
UpnpPrintf( UPNP_INFO, SSDP,
|
||||
__FILE__, __LINE__,
|
||||
"Received response !!! "
|
||||
"%s From host %s \n",
|
||||
"Start of received response ----------------------------------------------------\n"
|
||||
"%s\n"
|
||||
"End of received response ------------------------------------------------------\n"
|
||||
"From host %s\n",
|
||||
requestBuf,
|
||||
inet_ntoa( clientAddr.sin_addr ) );
|
||||
|
||||
UpnpPrintf( UPNP_PACKET, SSDP, __FILE__, __LINE__,
|
||||
"Received multicast packet:"
|
||||
"\n %s\n", requestBuf );
|
||||
"Start of received multicast packet --------------------------------------------\n"
|
||||
"%s\n"
|
||||
"End of received multicast packet ----------------------------------------------\n",
|
||||
requestBuf );
|
||||
//add thread pool job to handle request
|
||||
if( data != NULL ) {
|
||||
data->parser.msg.msg.length += byteReceived;
|
||||
@ -869,8 +873,7 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
||||
{
|
||||
SOCKET ssdpSock;
|
||||
|
||||
CLIENTONLY( SOCKET ssdpReqSock;
|
||||
)
|
||||
CLIENTONLY( SOCKET ssdpReqSock; )
|
||||
int onOff = 1;
|
||||
u_char ttl = 4;
|
||||
struct ip_mreq ssdpMcastAddr;
|
||||
@ -878,20 +881,20 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
||||
int option = 1;
|
||||
struct in_addr addr;
|
||||
|
||||
CLIENTONLY( if( ( ssdpReqSock = socket( AF_INET, SOCK_DGRAM, 0 ) )
|
||||
== UPNP_INVALID_SOCKET ) {
|
||||
CLIENTONLY(
|
||||
if( ( ssdpReqSock = socket( AF_INET, SOCK_DGRAM, 0 ) ) == UPNP_INVALID_SOCKET ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in socket operation !!!\n" );
|
||||
return UPNP_E_OUTOF_SOCKET;}
|
||||
setsockopt( ssdpReqSock,
|
||||
IPPROTO_IP,
|
||||
IP_MULTICAST_TTL, &ttl, sizeof( ttl ) );
|
||||
return UPNP_E_OUTOF_SOCKET;
|
||||
}
|
||||
setsockopt( ssdpReqSock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof( ttl ) );
|
||||
// just do it, regardless if fails or not.
|
||||
Make_Socket_NoBlocking( ssdpReqSock ); gSsdpReqSocket = ssdpReqSock; ) //CLIENTONLY
|
||||
Make_Socket_NoBlocking( ssdpReqSock );
|
||||
gSsdpReqSocket = ssdpReqSock; )
|
||||
// END CLIENTONLY
|
||||
|
||||
if( ( ssdpSock = socket( AF_INET, SOCK_DGRAM, 0 ) )
|
||||
== UPNP_INVALID_SOCKET ) {
|
||||
if( ( ssdpSock = socket( AF_INET, SOCK_DGRAM, 0 ) ) == UPNP_INVALID_SOCKET ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in socket operation !!!\n" );
|
||||
@ -903,7 +906,6 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
||||
onOff = 1;
|
||||
if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEADDR,
|
||||
( char * )&onOff, sizeof( onOff ) ) != 0 ) {
|
||||
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in set reuse addr !!!\n" );
|
||||
@ -917,7 +919,6 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
||||
#ifdef __FreeBSD__
|
||||
if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEPORT,
|
||||
( char * )&onOff, sizeof( onOff ) ) != 0 ) {
|
||||
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in set reuse port !!!\n" );
|
||||
@ -934,8 +935,7 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
||||
// ssdpAddr.sin_addr.s_addr = inet_addr(LOCAL_HOST);
|
||||
ssdpAddr.sin_addr.s_addr = htonl( INADDR_ANY );
|
||||
ssdpAddr.sin_port = htons( SSDP_PORT );
|
||||
if( bind
|
||||
( ssdpSock, ( struct sockaddr * )&ssdpAddr,
|
||||
if( bind( ssdpSock, ( struct sockaddr * )&ssdpAddr,
|
||||
sizeof( ssdpAddr ) ) != 0 ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
@ -951,8 +951,7 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
||||
ssdpMcastAddr.imr_interface.s_addr = inet_addr( LOCAL_HOST );
|
||||
ssdpMcastAddr.imr_multiaddr.s_addr = inet_addr( SSDP_IP );
|
||||
if( setsockopt( ssdpSock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
||||
( char * )&ssdpMcastAddr,
|
||||
sizeof( struct ip_mreq ) ) != 0 ) {
|
||||
( char * )&ssdpMcastAddr, sizeof( struct ip_mreq ) ) != 0 ) {
|
||||
UpnpPrintf( UPNP_CRITICAL,
|
||||
SSDP, __FILE__, __LINE__,
|
||||
"Error in joining" " multicast group !!!\n" );
|
||||
@ -988,10 +987,10 @@ get_ssdp_sockets( MiniServerSockArray * out )
|
||||
return UPNP_E_NETWORK_ERROR;
|
||||
}
|
||||
|
||||
CLIENTONLY( out->ssdpReqSock = ssdpReqSock;
|
||||
);
|
||||
CLIENTONLY( out->ssdpReqSock = ssdpReqSock; );
|
||||
out->ssdpSock = ssdpSock;
|
||||
return UPNP_E_SUCCESS;
|
||||
}
|
||||
|
||||
#endif // EXCLUDE_SSDP
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user