* 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:
Nektarios K. Papadopoulos 2007-05-24 10:18:30 +00:00
parent 8f7fd0fc6d
commit 947dfd9a85
4 changed files with 12 additions and 4 deletions

View File

@ -674,7 +674,7 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
threads = tp->totalThreads - tp->persistentThreads;
while( ( threads == 0 )
|| ( ( jobs / threads ) > tp->attr.jobsPerThread ) ) {
|| ( ( jobs / threads ) >= tp->attr.jobsPerThread ) ) {
if( CreateWorker( tp ) != 0 )
return;

View File

@ -88,6 +88,8 @@ CLIENTONLY( ithread_mutex_t GlobalClientSubscribeMutex; )
ThreadPool gSendThreadPool;
ThreadPool gMiniServerThreadPool;
//Flag to indicate the state of web server
WebServerState bWebServerState = WEB_SERVER_DISABLED;
@ -256,6 +258,12 @@ int UpnpInit( IN const char *HostIP,
return UPNP_E_INIT_FAILED;
}
if( ThreadPoolInit( &gMiniServerThreadPool, &attr ) != UPNP_E_SUCCESS ) {
UpnpSdkInit = 0;
UpnpFinish( );
return UPNP_E_INIT_FAILED;
}
UpnpSdkInit = 1;
#if EXCLUDE_SOAP == 0
SetSoapCallback( soap_device_callback );

View File

@ -359,7 +359,7 @@ schedule_request_job( IN int connfd,
TPJobSetFreeFunction( &job, free_handle_request_arg );
TPJobSetPriority( &job, MED_PRIORITY );
if( ThreadPoolAdd( &gRecvThreadPool, &job, NULL ) != 0 ) {
if( ThreadPoolAdd( &gMiniServerThreadPool, &job, NULL ) != 0 ) {
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
"mserv %d: cannot schedule request\n", connfd );
free( request );
@ -772,7 +772,7 @@ StartMiniServer( unsigned short listen_port )
TPJobSetFreeFunction( &job, ( free_routine ) free );
success = ThreadPoolAddPersistent( &gRecvThreadPool, &job, NULL );
success = ThreadPoolAddPersistent( &gMiniServerThreadPool, &job, NULL );
if( success < 0 ) {
shutdown( miniSocket->miniServerSock, SD_BOTH );

View File

@ -124,7 +124,7 @@ extern unsigned short LOCAL_PORT;
extern TimerThread gTimerThread;
extern ThreadPool gRecvThreadPool;
extern ThreadPool gSendThreadPool;
extern ThreadPool gMiniServerThreadPool;
typedef enum {
SUBSCRIBE,