GNUNET_free (q);
client->message_count--;
}
- GNUNET_assert (tsize > 0);
if (NULL != q)
{
+ GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader));
th = GNUNET_SERVER_notify_transmit_ready (client->client,
msize,
GNUNET_TIME_UNIT_FOREVER_REL,
}
client->message_count++;
msize = ntohs (msg->size);
+ GNUNET_assert (msize >= sizeof (struct GNUNET_MessageHeader));
q = GNUNET_malloc (sizeof (struct ClientMessageQueueEntry) + msize);
memcpy (&q[1], msg, msize);
/* append to message queue */
if (min_remaining.value < GNUNET_TIME_UNIT_FOREVER_REL.value)
plugin->address_update_task
= GNUNET_SCHEDULER_add_delayed (plugin->env.sched,
- GNUNET_NO,
- GNUNET_SCHEDULER_PRIORITY_IDLE,
- GNUNET_SCHEDULER_NO_TASK,
min_remaining,
&expire_address_task, plugin);
pos = pos->next;
}
GNUNET_SCHEDULER_add_delayed (sched,
- GNUNET_NO,
- GNUNET_SCHEDULER_PRIORITY_IDLE,
- GNUNET_SCHEDULER_NO_TASK,
GNUNET_TIME_absolute_get_remaining (first),
&cleanup_validation, NULL);
}
GNUNET_i2s (peer));
#endif
pos->timeout.value = 0;
- GNUNET_SCHEDULER_add_delayed (sched,
- GNUNET_NO,
- GNUNET_SCHEDULER_PRIORITY_IDLE,
- GNUNET_SCHEDULER_NO_TASK,
- GNUNET_TIME_UNIT_ZERO,
- &cleanup_validation, NULL);
+ GNUNET_SCHEDULER_add_with_priority (sched,
+ GNUNET_SCHEDULER_PRIORITY_IDLE,
+ &cleanup_validation, NULL);
}
else
{
va = va->next;
}
GNUNET_SCHEDULER_add_delayed (sched,
- GNUNET_NO,
- GNUNET_SCHEDULER_PRIORITY_IDLE,
- GNUNET_SCHEDULER_NO_TASK,
GNUNET_TIME_absolute_get_remaining (chvc->e->timeout),
&cleanup_validation, NULL);
GNUNET_free (chvc);
n->quota_in = (GNUNET_CONSTANTS_DEFAULT_BPM_IN_OUT + 59999) / (60 * 1000);
add_plugins (n);
n->timeout_task = GNUNET_SCHEDULER_add_delayed (sched,
- GNUNET_NO,
- GNUNET_SCHEDULER_PRIORITY_IDLE,
- GNUNET_SCHEDULER_NO_TASK,
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
&neighbour_timeout_task, n);
transmit_to_peer (NULL, 0,
* reducing the rate at which they read from the socket
* and generally forward to our receive callback.
*
+ * @param cls the "struct TransportPlugin *" we gave to the plugin
* @param plugin_context value to pass to this plugin
* to respond to the given peer (use is optional,
* but may speed up processing)
n->peer_timeout =
GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
n->timeout_task =
- GNUNET_SCHEDULER_add_delayed (sched, GNUNET_NO,
- GNUNET_SCHEDULER_PRIORITY_IDLE,
- GNUNET_SCHEDULER_NO_TASK,
+ GNUNET_SCHEDULER_add_delayed (sched,
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
&neighbour_timeout_task, n);
update_quota (n);
}
+/**
+ * Function called when the service shuts down. Unloads our plugins.
+ *
+ * @param cls closure, unused
+ * @param tc task context (unused)
+ */
+static void
+unload_plugins (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct TransportPlugin *plug;
+ struct AddressList *al;
+
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Transport service is unloading plugins...\n");
+#endif
+ while (NULL != (plug = plugins))
+ {
+ plugins = plug->next;
+ GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api));
+ GNUNET_free (plug->lib_name);
+ GNUNET_free (plug->short_name);
+ while (NULL != (al = plug->addresses))
+ {
+ plug->addresses = al->next;
+ GNUNET_free (al);
+ }
+ GNUNET_free (plug);
+ }
+ if (my_private_key != NULL)
+ GNUNET_CRYPTO_rsa_key_free (my_private_key);
+ GNUNET_free_non_null (our_hello);
+}
+
+
/**
* Initiate transport service.
*
}
GNUNET_free (plugs);
}
+ GNUNET_SCHEDULER_add_delayed (sched,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ &unload_plugins, NULL);
if (no_transports)
refresh_hello ();
#if DEBUG_TRANSPORT
}
-/**
- * Function called when the service shuts
- * down. Unloads our plugins.
- *
- * @param cls closure
- * @param cfg configuration to use
- */
-static void
-unload_plugins (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- struct TransportPlugin *plug;
- struct AddressList *al;
-
-#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Transport service is unloading plugins...\n");
-#endif
- while (NULL != (plug = plugins))
- {
- plugins = plug->next;
- GNUNET_break (NULL == GNUNET_PLUGIN_unload (plug->lib_name, plug->api));
- GNUNET_free (plug->lib_name);
- GNUNET_free (plug->short_name);
- while (NULL != (al = plug->addresses))
- {
- plug->addresses = al->next;
- GNUNET_free (al);
- }
- GNUNET_free (plug);
- }
- if (my_private_key != NULL)
- GNUNET_CRYPTO_rsa_key_free (my_private_key);
- GNUNET_free_non_null (our_hello);
-}
-
-
/**
* The main function for the transport service.
*
GNUNET_SERVICE_run (argc,
argv,
"transport",
- &run, NULL, &unload_plugins, NULL)) ? 0 : 1;
+ &run, NULL)) ? 0 : 1;
}
/* end of gnunet-service-transport.c */