{
n->plugins = rpos->next;
GNUNET_assert (rpos->neighbour == n);
- rpos->plugin->api->cancel (rpos->plugin->api->cls,
- rpos->plugin_handle,
- rpos,
- &n->id);
+ if (GNUNET_YES == rpos->connected)
+ rpos->plugin->api->cancel (rpos->plugin->api->cls,
+ rpos->plugin_handle,
+ rpos,
+ &n->id);
GNUNET_free (rpos);
}
GNUNET_assert (mq->neighbour == n);
GNUNET_free (mq);
}
-
+ if (n->timeout_task != GNUNET_SCHEDULER_NO_PREREQUISITE_TASK)
+ GNUNET_SCHEDULER_cancel (sched,
+ n->timeout_task);
/* finally, free n itself */
GNUNET_free (n);
}
GNUNET_i2s(&n->id));
#endif
/* TODO: call stats */
- disconnect_neighbour (n);
if ((service_context != NULL) &&
(service_context->plugin_handle == plugin_context))
{
service_context->connected = GNUNET_NO;
service_context->plugin_handle = NULL;
}
+ disconnect_neighbour (n);
return NULL;
}
#if DEBUG_TRANSPORT
}
if (my_private_key != NULL)
GNUNET_CRYPTO_rsa_key_free (my_private_key);
+ GNUNET_free_non_null (our_hello);
}
main (int argc, char *const *argv)
{
return (GNUNET_OK ==
- GNUNET_SERVICE_run (argc,
- argv,
- "transport",
- &run, NULL, &unload_plugins, NULL)) ? 0 : 1;
+ GNUNET_SERVICE_run (argc,
+ argv,
+ "transport",
+ &run, NULL, &unload_plugins, NULL)) ? 0 : 1;
}
/* end of gnunet-service-transport.c */
ret = plugin->sessions;
while ((ret != NULL) &&
- (0 != memcmp (target,
- &ret->target, sizeof (struct GNUNET_PeerIdentity))))
+ ( (GNUNET_SYSERR == ret->expecting_welcome) ||
+ (0 != memcmp (target,
+ &ret->target, sizeof (struct GNUNET_PeerIdentity)))))
ret = ret->next;
return ret;
}
GNUNET_TIME_UNIT_ZERO,
&session->target, NULL);
}
+ if (session->client != NULL)
+ {
+ GNUNET_SERVER_client_drop (session->client);
+ session->client = NULL;
+ }
GNUNET_free_non_null (session->connect_addr);
GNUNET_free (session);
}
{
struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
struct Plugin *plugin = api->cls;
+ struct Session *session;
+ while (NULL != (session = plugin->sessions))
+ disconnect_session (session);
GNUNET_SERVICE_stop (plugin->service);
GNUNET_free (plugin->handlers);
GNUNET_free (plugin);
if (buf == NULL)
{
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Could not transmit to transport service, cancelling pending requests\n");
#endif
th = h->connect_ready_head;
struct HelloWaitList *pos;
struct HelloWaitList *prev;
+ hwl->task = GNUNET_SCHEDULER_NO_PREREQUISITE_TASK;
+ if (GNUNET_TIME_absolute_get_remaining (hwl->timeout).value > 0)
+ {
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ _("First attempt to obtain `%s' from transport service failed, will try again for %llums.\n"),
+ "HELLO",
+ GNUNET_TIME_absolute_get_remaining (hwl->timeout).value);
+#endif
+ hwl->task = GNUNET_SCHEDULER_add_delayed (hwl->handle->sched,
+ GNUNET_YES,
+ GNUNET_SCHEDULER_PRIORITY_KEEP,
+ GNUNET_SCHEDULER_NO_PREREQUISITE_TASK,
+ GNUNET_TIME_absolute_get_remaining (hwl->timeout),
+ &hello_wait_timeout, hwl);
+ return;
+ }
+ /* signal timeout */
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Timeout trying to obtain `%s' from transport service.\n"),
+ "HELLO");
prev = NULL;
pos = hwl->handle->hwl_head;
while (pos != hwl)
hwl->handle->hwl_head = hwl->next;
else
prev->next = hwl->next;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Timeout trying to obtain `%s' from transport service.\n"),
- "HELLO");
- /* signal timeout */
if (hwl->rec != NULL)
hwl->rec (hwl->rec_cls, GNUNET_TIME_UNIT_ZERO, NULL, NULL);
GNUNET_free (hwl);
if (buf == NULL)
{
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Timeout while trying to transmit `%s' request.\n",
"START");
#endif
schedule_control_transmit (h,
sizeof (struct GNUNET_MessageHeader),
GNUNET_YES,
- GNUNET_TIME_UNIT_FOREVER_REL, &send_start, NULL);
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ &send_start, NULL);
GNUNET_CLIENT_receive (h->client,
&demultiplexer, h, GNUNET_TIME_UNIT_FOREVER_REL);
}