}
if (local_handle->watch_id > 0) {
- g_source_remove(local_handle->watch_id);
+ GMainContext *context = g_main_context_get_thread_default();
+ GSource *source = g_main_context_find_source_by_id(context, local_handle->watch_id);
+ g_source_destroy(source);
local_handle->watch_id = 0;
}
DNSSD_LOCK;
DNSSD_LOGD("Remove DNSServiceGetAddrInfo socket");
dnssd_handle_s *local_handle = user_data;
- if (local_handle->watch_id > 0)
- g_source_remove(local_handle->watch_id);
+ if (local_handle->watch_id > 0) {
+ GMainContext *context = g_main_context_get_thread_default();
+ GSource *source = g_main_context_find_source_by_id(context, local_handle->watch_id);
+ g_source_destroy(source);
+ }
DNSServiceRefDeallocate(local_handle->sd_ref);
local_handle->watch_id = 0;
local_handle->sd_ref = NULL;
DNSSD_LOCK;
DNSSD_LOGD("Remove DNSServiceResolve socket");
resolve_reply_data *resolve_data = user_data;
- if (resolve_data->watch_id > 0)
- g_source_remove(resolve_data->watch_id);
+ if (resolve_data->watch_id > 0) {
+ GMainContext *context = g_main_context_get_thread_default();
+ GSource *source = g_main_context_find_source_by_id(context, resolve_data->watch_id);
+ g_source_destroy(source);
+ }
DNSServiceRefDeallocate(resolve_data->sd_ref);
resolve_data->watch_id = 0;
resolve_data->sd_ref = NULL;
host_name, resolve_data->service_name, fullname,
(const char *) txt_record, txt_len, port);
- g_idle_add_full(G_PRIORITY_HIGH, __remove_service_resolve_socket,
- resolve_data, NULL);
+ __remove_service_resolve_socket(resolve_data);
DNSSD_UNLOCK;
}
void __destroy_browsing_handle(dnssd_handle_s *browsing_handle)
{
- if (browsing_handle->watch_id > 0)
- g_source_remove(browsing_handle->watch_id);
+ if (browsing_handle->watch_id > 0) {
+ GMainContext *context = g_main_context_get_thread_default();
+ GSource *source = g_main_context_find_source_by_id(context, browsing_handle->watch_id);
+ g_source_destroy(source);
+ }
DNSServiceRefDeallocate(browsing_handle->sd_ref);
browsing_handle->sd_ref = NULL;