LOG (GNUNET_ERROR_TYPE_DEBUG,
"Init message timed out\n");
+ h->init_timeout_task_id = GNUNET_SCHEDULER_NO_TASK;
reconnect_arm_monitor_later (h);
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
"arm_api, GNUNET_CLIENT_connect returned NULL\n");
if (NULL != h->service_status)
- h->service_status (h->cls, h, NULL, GNUNET_ARM_SERVICE_STOPPED);
+ h->service_status (h->cls, NULL, GNUNET_ARM_SERVICE_STOPPED);
return GNUNET_SYSERR;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
/**
* Disconnect from the ARM service (if connected) and destroy the context.
- * Don't call inside a callback!
*
* @param h the handle that was being used
*/
void
-GNUNET_ARM_monitor_disconnect_and_free (struct GNUNET_ARM_MonitorHandle *handle)
+GNUNET_ARM_monitor_disconnect_and_free (struct GNUNET_ARM_MonitorHandle *h)
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from ARM service\n");
- if (NULL != handle->cth)
+ if (NULL != h->cth)
{
- GNUNET_CLIENT_notify_transmit_ready_cancel (handle->cth);
- handle->cth = NULL;
+ GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth);
+ h->cth = NULL;
}
- if (GNUNET_SCHEDULER_NO_TASK != handle->init_timeout_task_id)
+ if (GNUNET_SCHEDULER_NO_TASK != h->init_timeout_task_id)
{
- GNUNET_SCHEDULER_cancel (handle->init_timeout_task_id);
- handle->init_timeout_task_id = GNUNET_SCHEDULER_NO_TASK;
+ GNUNET_SCHEDULER_cancel (h->init_timeout_task_id);
+ h->init_timeout_task_id = GNUNET_SCHEDULER_NO_TASK;
}
- if (NULL != handle->monitor)
+ if (NULL != h->monitor)
{
- GNUNET_CLIENT_disconnect (handle->monitor);
- handle->monitor = NULL;
+ GNUNET_CLIENT_disconnect (h->monitor);
+ h->monitor = NULL;
}
- if (GNUNET_SCHEDULER_NO_TASK != handle->reconnect_task)
+ if (GNUNET_SCHEDULER_NO_TASK != h->reconnect_task)
{
- GNUNET_SCHEDULER_cancel (handle->reconnect_task);
- handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
+ GNUNET_SCHEDULER_cancel (h->reconnect_task);
+ h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
}
- GNUNET_CONFIGURATION_destroy (handle->cfg);
- GNUNET_free (handle);
+ GNUNET_CONFIGURATION_destroy (h->cfg);
+ GNUNET_free (h);
}
"Received response from ARM for service `%s': %u\n",
(const char *) &res[1], ntohs (msg->type));
status = (enum GNUNET_ARM_ServiceStatus) ntohl (res->status);
- if ((NULL != h->service_status))
- h->service_status (h->cls, h, (const char *) &res[1], status);
+ GNUNET_CLIENT_receive (h->monitor, &monitor_notify_handler, h,
+ GNUNET_TIME_UNIT_FOREVER_REL);
+ if (NULL != h->service_status)
+ h->service_status (h->cls, (const char *) &res[1], status);
break;
default:
reconnect_arm_monitor_later (h);
return;
}
- GNUNET_CLIENT_receive (h->monitor, &monitor_notify_handler, h,
- GNUNET_TIME_UNIT_FOREVER_REL);
}