* SF Tracker FR [ 1570020 ].
* Enable both device and control point in the same application. Resolve deadlock in the SSDP processing threads. * Fix Threadpool expansion condition. Thanks to Siva Chandran P. for the original patch. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@194 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
@@ -674,7 +674,7 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
|
|||||||
threads = tp->totalThreads - tp->persistentThreads;
|
threads = tp->totalThreads - tp->persistentThreads;
|
||||||
|
|
||||||
while( ( threads == 0 )
|
while( ( threads == 0 )
|
||||||
|| ( ( jobs / threads ) > tp->attr.jobsPerThread ) ) {
|
|| ( ( jobs / threads ) >= tp->attr.jobsPerThread ) ) {
|
||||||
|
|
||||||
if( CreateWorker( tp ) != 0 )
|
if( CreateWorker( tp ) != 0 )
|
||||||
return;
|
return;
|
||||||
|
@@ -88,6 +88,8 @@ CLIENTONLY( ithread_mutex_t GlobalClientSubscribeMutex; )
|
|||||||
|
|
||||||
ThreadPool gSendThreadPool;
|
ThreadPool gSendThreadPool;
|
||||||
|
|
||||||
|
ThreadPool gMiniServerThreadPool;
|
||||||
|
|
||||||
//Flag to indicate the state of web server
|
//Flag to indicate the state of web server
|
||||||
WebServerState bWebServerState = WEB_SERVER_DISABLED;
|
WebServerState bWebServerState = WEB_SERVER_DISABLED;
|
||||||
|
|
||||||
@@ -256,6 +258,12 @@ int UpnpInit( IN const char *HostIP,
|
|||||||
return UPNP_E_INIT_FAILED;
|
return UPNP_E_INIT_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ThreadPoolInit( &gMiniServerThreadPool, &attr ) != UPNP_E_SUCCESS ) {
|
||||||
|
UpnpSdkInit = 0;
|
||||||
|
UpnpFinish( );
|
||||||
|
return UPNP_E_INIT_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
UpnpSdkInit = 1;
|
UpnpSdkInit = 1;
|
||||||
#if EXCLUDE_SOAP == 0
|
#if EXCLUDE_SOAP == 0
|
||||||
SetSoapCallback( soap_device_callback );
|
SetSoapCallback( soap_device_callback );
|
||||||
|
@@ -359,7 +359,7 @@ schedule_request_job( IN int connfd,
|
|||||||
TPJobSetFreeFunction( &job, free_handle_request_arg );
|
TPJobSetFreeFunction( &job, free_handle_request_arg );
|
||||||
TPJobSetPriority( &job, MED_PRIORITY );
|
TPJobSetPriority( &job, MED_PRIORITY );
|
||||||
|
|
||||||
if( ThreadPoolAdd( &gRecvThreadPool, &job, NULL ) != 0 ) {
|
if( ThreadPoolAdd( &gMiniServerThreadPool, &job, NULL ) != 0 ) {
|
||||||
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
|
||||||
"mserv %d: cannot schedule request\n", connfd );
|
"mserv %d: cannot schedule request\n", connfd );
|
||||||
free( request );
|
free( request );
|
||||||
@@ -772,7 +772,7 @@ StartMiniServer( unsigned short listen_port )
|
|||||||
|
|
||||||
TPJobSetFreeFunction( &job, ( free_routine ) free );
|
TPJobSetFreeFunction( &job, ( free_routine ) free );
|
||||||
|
|
||||||
success = ThreadPoolAddPersistent( &gRecvThreadPool, &job, NULL );
|
success = ThreadPoolAddPersistent( &gMiniServerThreadPool, &job, NULL );
|
||||||
|
|
||||||
if( success < 0 ) {
|
if( success < 0 ) {
|
||||||
shutdown( miniSocket->miniServerSock, SD_BOTH );
|
shutdown( miniSocket->miniServerSock, SD_BOTH );
|
||||||
|
@@ -124,7 +124,7 @@ extern unsigned short LOCAL_PORT;
|
|||||||
extern TimerThread gTimerThread;
|
extern TimerThread gTimerThread;
|
||||||
extern ThreadPool gRecvThreadPool;
|
extern ThreadPool gRecvThreadPool;
|
||||||
extern ThreadPool gSendThreadPool;
|
extern ThreadPool gSendThreadPool;
|
||||||
|
extern ThreadPool gMiniServerThreadPool;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SUBSCRIBE,
|
SUBSCRIBE,
|
||||||
|
Reference in New Issue
Block a user