Commit d3a659d9 authored by Laurent Aimar's avatar Laurent Aimar

Moved static lock inside Cookie.

parent c42248cf
...@@ -77,6 +77,7 @@ typedef struct ...@@ -77,6 +77,7 @@ typedef struct
services_discovery_t* serviceDiscovery; services_discovery_t* serviceDiscovery;
UpnpClient_Handle clientHandle; UpnpClient_Handle clientHandle;
MediaServerList* serverList; MediaServerList* serverList;
Lockable* lock;
} Cookie; } Cookie;
...@@ -275,7 +276,6 @@ vlc_module_end(); ...@@ -275,7 +276,6 @@ vlc_module_end();
// More prototypes... // More prototypes...
static Lockable* CallbackLock;
static int Callback( Upnp_EventType eventType, void* event, void* pCookie ); static int Callback( Upnp_EventType eventType, void* event, void* pCookie );
const char* xml_getChildElementValue( IXML_Element* parent, const char* tagName ); const char* xml_getChildElementValue( IXML_Element* parent, const char* tagName );
...@@ -333,8 +333,7 @@ static void Run( services_discovery_t* p_sd ) ...@@ -333,8 +333,7 @@ static void Run( services_discovery_t* p_sd )
Cookie cookie; Cookie cookie;
cookie.serviceDiscovery = p_sd; cookie.serviceDiscovery = p_sd;
cookie.serverList = new MediaServerList( &cookie ); cookie.serverList = new MediaServerList( &cookie );
cookie.lock = new Lockable();
CallbackLock = new Lockable( &cookie );
res = UpnpRegisterClient( Callback, &cookie, &cookie.clientHandle ); res = UpnpRegisterClient( Callback, &cookie, &cookie.clientHandle );
if( res != UPNP_E_SUCCESS ) if( res != UPNP_E_SUCCESS )
...@@ -361,7 +360,7 @@ static void Run( services_discovery_t* p_sd ) ...@@ -361,7 +360,7 @@ static void Run( services_discovery_t* p_sd )
shutDown: shutDown:
UpnpFinish(); UpnpFinish();
delete cookie.serverList; delete cookie.serverList;
delete CallbackLock; delete cookie.lock;
} }
...@@ -419,10 +418,10 @@ IXML_Document* parseBrowseResult( IXML_Document* doc ) ...@@ -419,10 +418,10 @@ IXML_Document* parseBrowseResult( IXML_Document* doc )
// Handles all UPnP events // Handles all UPnP events
static int Callback( Upnp_EventType eventType, void* event, void* pCookie ) static int Callback( Upnp_EventType eventType, void* event, void* pCookie )
{ {
Locker locker( CallbackLock );
Cookie* cookie = ( Cookie* )pCookie; Cookie* cookie = ( Cookie* )pCookie;
Locker locker( cookie->lock );
switch( eventType ) { switch( eventType ) {
case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE: case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment