static gboolean task_worker(gpointer p, GError **error) { worker_t *asn1_worker; struct namespace_data_s *ns_data; ns_data = g_hash_table_lookup(namespaces, (gchar*)p); if (!ns_data) { GSETERROR(error,"Namespace '%s' not found", (gchar*)p); return FALSE; } asn1_worker = create_asn1_worker(&(ns_data->ns_info.addr), NAME_MSGNAME_CS_GET_NSINFO); asn1_worker_set_session_data(asn1_worker, g_strdup(ns_data->name), session_data_cleaner); asn1_worker_set_handlers(asn1_worker,parse_namespace_info,error_handler,final_handler); error = NULL; if (!asn1_request_worker(asn1_worker, error)) { free_asn1_worker(asn1_worker,TRUE); GSETERROR(error,"Failed to send asn1 request"); return FALSE; } return TRUE; }
static gboolean create_sub_worker( struct namespace_data_s *ns_data, worker_t *orig_worker, GError **error ) { worker_t *asn1_worker; TRACE_POSITION(); /*Prepare the ASN.1 session for the future worker*/ asn1_worker = create_asn1_worker(&(ns_data->ns_info.addr), NAME_MSGNAME_CS_RM_BROKEN_CONT); asn1_worker_set_handlers(asn1_worker, agent_asn1_default_response_handler, asn1_error_handler, asn1_final_handler); asn1_worker_set_session_data(asn1_worker,orig_worker,NULL); /*Then create the ASN.1 worker*/ if (!asn1_request_worker(asn1_worker, error)) { free_asn1_worker(asn1_worker,TRUE); GSETERROR(error, "Failed to send asn1 request"); return FALSE; } return TRUE; }