-bugfixes, code cleanup
[oweals/gnunet.git] / src / vpn / gnunet-service-vpn.c
index 219949bd31791115d9d6a46259d8836de8500ee0..abdc16d79a6f1f622f78141e03de1588b318ca88 100644 (file)
@@ -689,7 +689,6 @@ send_to_peer_notify_callback (void *cls, size_t size, void *buf)
   if (NULL != (tnq = ts->tmq_head))
     ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, 
                                                GNUNET_NO /* cork */, 
-                                               42 /* priority */,
                                                GNUNET_TIME_UNIT_FOREVER_REL,
                                                NULL, 
                                                tnq->len,
@@ -742,7 +741,6 @@ send_to_tunnel (struct TunnelMessageQueueEntry *tnq,
   if (NULL == ts->th)
     ts->th = GNUNET_MESH_notify_transmit_ready (ts->tunnel, 
                                                GNUNET_NO /* cork */,
-                                               42 /* priority */,
                                                GNUNET_TIME_UNIT_FOREVER_REL,
                                                NULL, 
                                                tnq->len,
@@ -3004,31 +3002,6 @@ client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
 }
 
 
-/**
- * Test if the given AF is supported by this system.
- * 
- * @param af to test
- * @return GNUNET_OK if the AF is supported
- */
-static int
-test_af (int af)
-{
-  int s;
-
-  s = socket (af, SOCK_STREAM, 0);
-  if (-1 == s)
-  {
-    if (EAFNOSUPPORT == errno)
-      return GNUNET_NO;
-    GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
-                        "socket");
-    return GNUNET_SYSERR;
-  }
-  close (s);
-  return GNUNET_OK;
-}
-
-
 /**
  * Main function that will be run by the scheduler.
  *
@@ -3086,9 +3059,9 @@ run (void *cls,
                                             &max_tunnel_mappings))
     max_tunnel_mappings = 200;
 
-  destination_map = GNUNET_CONTAINER_multihashmap_create (max_destination_mappings * 2);
+  destination_map = GNUNET_CONTAINER_multihashmap_create (max_destination_mappings * 2, GNUNET_NO);
   destination_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
-  tunnel_map = GNUNET_CONTAINER_multihashmap_create (max_tunnel_mappings * 2);
+  tunnel_map = GNUNET_CONTAINER_multihashmap_create (max_tunnel_mappings * 2, GNUNET_NO);
   tunnel_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
 
 
@@ -3102,7 +3075,7 @@ run (void *cls,
     return;
   }
   vpn_argv[1] = ifname;
-  if (GNUNET_OK == test_af (AF_INET6))
+  if (GNUNET_OK == GNUNET_NETWORK_test_pf (PF_INET6))
   {
     if ( (GNUNET_SYSERR ==
          GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", "IPV6ADDR",
@@ -3142,7 +3115,7 @@ run (void *cls,
     vpn_argv[2] = GNUNET_strdup ("-");
     vpn_argv[3] = GNUNET_strdup ("-");
   }
-  if (GNUNET_OK == test_af (AF_INET))
+  if (GNUNET_OK == GNUNET_NETWORK_test_pf (PF_INET))
   {
     if ( (GNUNET_SYSERR ==
          GNUNET_CONFIGURATION_get_value_string (cfg, "vpn", "IPV4ADDR",
@@ -3177,13 +3150,14 @@ run (void *cls,
   vpn_argv[6] = NULL;
 
   mesh_handle =
-    GNUNET_MESH_connect (cfg_, 42 /* queue length */, NULL, 
+    GNUNET_MESH_connect (cfg_, NULL, 
                         &inbound_tunnel_cb, 
                         &tunnel_cleaner, 
                         mesh_handlers,
                         types);
-  helper_handle = GNUNET_HELPER_start ("gnunet-helper-vpn", vpn_argv,
-                                      &message_token, NULL);
+  helper_handle = GNUNET_HELPER_start (GNUNET_NO,
+                                      "gnunet-helper-vpn", vpn_argv,
+                                      &message_token, NULL, NULL);
   nc = GNUNET_SERVER_notification_context_create (server, 1);
   GNUNET_SERVER_add_handlers (server, service_handlers);
   GNUNET_SERVER_disconnect_notify (server, &client_disconnect, NULL);