v2: Returns HRESULT from functions where applicable, adds Probe message body parsing to avoid leaving todo_wine statements in place.
Signed-off-by: Owen Rudge orudge@codeweavers.com
--- dlls/wsdapi/network.c | 281 +++++++++++++++++++++++++++++++++++++++++- dlls/wsdapi/wsdapi_internal.h | 4 + 2 files changed, 284 insertions(+), 1 deletion(-)
On Mon, Jun 11, 2018 at 11:06:14PM +0100, Owen Rudge wrote:
v2: Returns HRESULT from functions where applicable, adds Probe message body parsing to avoid leaving todo_wine statements in place.
Signed-off-by: Owen Rudge orudge@codeweavers.com
dlls/wsdapi/network.c | 281 +++++++++++++++++++++++++++++++++++++++++- dlls/wsdapi/wsdapi_internal.h | 4 + 2 files changed, 284 insertions(+), 1 deletion(-)
void terminate_networking(IWSDiscoveryPublisherImpl *impl) { BOOL needsCleanup = impl->publisherStarted;
impl->publisherStarted = FALSE;
- WaitForMultipleObjects(impl->num_thread_handles, impl->thread_handles, TRUE, INFINITE);
The thread handles need closing.
if (needsCleanup) WSACleanup();
@@ -254,6 +524,15 @@ BOOL init_networking(IWSDiscoveryPublisherImpl *impl)
impl->publisherStarted = TRUE;
- /* TODO: Start listening */
- if ((impl->addressFamily & WSDAPI_ADDRESSFAMILY_IPV4) && (!start_listening_on_all_addresses(impl, AF_INET)))
goto cleanup;
- if ((impl->addressFamily & WSDAPI_ADDRESSFAMILY_IPV6) && (!start_listening_on_all_addresses(impl, AF_INET6)))
goto cleanup;
- return TRUE;
+cleanup:
- terminate_networking(impl);
- return FALSE;
} diff --git a/dlls/wsdapi/wsdapi_internal.h b/dlls/wsdapi/wsdapi_internal.h index 45d54c2ef1..f88822d5ef 100644 --- a/dlls/wsdapi/wsdapi_internal.h +++ b/dlls/wsdapi/wsdapi_internal.h @@ -40,6 +40,8 @@ struct notificationSink IWSDiscoveryPublisherNotify *notificationSink; };
+#define MAX_WSD_THREADS 20
typedef struct IWSDiscoveryPublisherImpl { IWSDiscoveryPublisher IWSDiscoveryPublisher_iface; LONG ref; @@ -47,6 +49,8 @@ typedef struct IWSDiscoveryPublisherImpl { DWORD addressFamily; struct list notificationSinks; BOOL publisherStarted;
- HANDLE thread_handles[MAX_WSD_THREADS];
- int num_thread_handles;
} IWSDiscoveryPublisherImpl;
/* network.c */