diff options
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 7141563a2..ed6fc847a 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -2053,6 +2053,18 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
2053 | 2053 | ||
2054 | int res; | 2054 | int res; |
2055 | 2055 | ||
2056 | if (NULL == env->receive) | ||
2057 | { | ||
2058 | /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully | ||
2059 | initialze the plugin or the API */ | ||
2060 | api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); | ||
2061 | api->cls = NULL; | ||
2062 | api->address_pretty_printer = &udp_plugin_address_pretty_printer; | ||
2063 | api->address_to_string = &udp_address_to_string; | ||
2064 | api->string_to_address = NULL; // FIXME! | ||
2065 | return api; | ||
2066 | } | ||
2067 | |||
2056 | /* Get port number */ | 2068 | /* Get port number */ |
2057 | if (GNUNET_OK != | 2069 | if (GNUNET_OK != |
2058 | GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-udp", "PORT", | 2070 | GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-udp", "PORT", |
@@ -2158,6 +2170,7 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
2158 | api->disconnect = &udp_disconnect; | 2170 | api->disconnect = &udp_disconnect; |
2159 | api->address_pretty_printer = &udp_plugin_address_pretty_printer; | 2171 | api->address_pretty_printer = &udp_plugin_address_pretty_printer; |
2160 | api->address_to_string = &udp_address_to_string; | 2172 | api->address_to_string = &udp_address_to_string; |
2173 | api->string_to_address = NULL; // FIXME! | ||
2161 | api->check_address = &udp_plugin_check_address; | 2174 | api->check_address = &udp_plugin_check_address; |
2162 | api->get_session = &udp_plugin_get_session; | 2175 | api->get_session = &udp_plugin_get_session; |
2163 | api->send = &udp_plugin_send; | 2176 | api->send = &udp_plugin_send; |
@@ -2182,11 +2195,13 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
2182 | return api; | 2195 | return api; |
2183 | } | 2196 | } |
2184 | 2197 | ||
2185 | int heap_cleanup_iterator (void *cls, | 2198 | |
2186 | struct GNUNET_CONTAINER_HeapNode * | 2199 | static int |
2187 | node, void *element, | 2200 | heap_cleanup_iterator (void *cls, |
2188 | GNUNET_CONTAINER_HeapCostType | 2201 | struct GNUNET_CONTAINER_HeapNode * |
2189 | cost) | 2202 | node, void *element, |
2203 | GNUNET_CONTAINER_HeapCostType | ||
2204 | cost) | ||
2190 | { | 2205 | { |
2191 | struct DefragContext * d_ctx = element; | 2206 | struct DefragContext * d_ctx = element; |
2192 | 2207 | ||
@@ -2203,13 +2218,20 @@ int heap_cleanup_iterator (void *cls, | |||
2203 | * returns the udp transport API. | 2218 | * returns the udp transport API. |
2204 | * | 2219 | * |
2205 | * @param cls our 'struct GNUNET_TRANSPORT_PluginEnvironment' | 2220 | * @param cls our 'struct GNUNET_TRANSPORT_PluginEnvironment' |
2206 | * @return our 'struct GNUNET_TRANSPORT_PluginFunctions' | 2221 | * @return NULL |
2207 | */ | 2222 | */ |
2208 | void * | 2223 | void * |
2209 | libgnunet_plugin_transport_udp_done (void *cls) | 2224 | libgnunet_plugin_transport_udp_done (void *cls) |
2210 | { | 2225 | { |
2211 | struct GNUNET_TRANSPORT_PluginFunctions *api = cls; | 2226 | struct GNUNET_TRANSPORT_PluginFunctions *api = cls; |
2212 | struct Plugin *plugin = api->cls; | 2227 | struct Plugin *plugin = api->cls; |
2228 | |||
2229 | if (NULL == plugin) | ||
2230 | { | ||
2231 | GNUNET_free (api); | ||
2232 | return NULL; | ||
2233 | } | ||
2234 | |||
2213 | stop_broadcast (plugin); | 2235 | stop_broadcast (plugin); |
2214 | 2236 | ||
2215 | if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK) | 2237 | if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK) |