aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_unix.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-03-10 23:17:45 +0000
committerChristian Grothoff <christian@grothoff.org>2012-03-10 23:17:45 +0000
commit854e1e4d0d1fcfa9812336ebfae76538a9197351 (patch)
tree83bbf1e3e17cc7400ea85d21e9177bff522b1f11 /src/transport/plugin_transport_unix.c
parentda6e72d97f0125825d5348d12b75b39efc7d2b39 (diff)
downloadgnunet-854e1e4d0d1fcfa9812336ebfae76538a9197351.tar.gz
gnunet-854e1e4d0d1fcfa9812336ebfae76538a9197351.zip
add support for stub-mode for transport plugins
Diffstat (limited to 'src/transport/plugin_transport_unix.c')
-rw-r--r--src/transport/plugin_transport_unix.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index 499cc23ad..51fbcd081 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -1027,6 +1027,18 @@ libgnunet_plugin_transport_unix_init (void *cls)
1027 struct Plugin *plugin; 1027 struct Plugin *plugin;
1028 int sockets_created; 1028 int sockets_created;
1029 1029
1030 if (NULL == env->receive)
1031 {
1032 /* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
1033 initialze the plugin or the API */
1034 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
1035 api->cls = NULL;
1036 api->address_pretty_printer = &unix_plugin_address_pretty_printer;
1037 api->address_to_string = &unix_address_to_string;
1038 api->string_to_address = NULL; // FIXME!
1039 return api;
1040 }
1041
1030 if (GNUNET_OK != 1042 if (GNUNET_OK !=
1031 GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-unix", "PORT", 1043 GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-unix", "PORT",
1032 &port)) 1044 &port))
@@ -1062,6 +1074,11 @@ libgnunet_plugin_transport_unix_done (void *cls)
1062 struct GNUNET_TRANSPORT_PluginFunctions *api = cls; 1074 struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
1063 struct Plugin *plugin = api->cls; 1075 struct Plugin *plugin = api->cls;
1064 1076
1077 if (NULL == plugin)
1078 {
1079 GNUNET_free (api);
1080 return NULL;
1081 }
1065 unix_transport_server_stop (plugin); 1082 unix_transport_server_stop (plugin);
1066 1083
1067 GNUNET_CONTAINER_multihashmap_iterate (plugin->session_map, &get_session_delete_it, plugin); 1084 GNUNET_CONTAINER_multihashmap_iterate (plugin->session_map, &get_session_delete_it, plugin);