gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r37556 - in gnunet/src: conversation exit fs multicast pt r


From: gnunet
Subject: [GNUnet-SVN] r37556 - in gnunet/src: conversation exit fs multicast pt rps scalarproduct set vpn
Date: Wed, 20 Jul 2016 19:13:27 +0200

Author: bartpolot
Date: 2016-07-20 19:13:26 +0200 (Wed, 20 Jul 2016)
New Revision: 37556

Modified:
   gnunet/src/conversation/gnunet-service-conversation.c
   gnunet/src/exit/gnunet-daemon-exit.c
   gnunet/src/fs/gnunet-service-fs_cadet_client.c
   gnunet/src/fs/gnunet-service-fs_cadet_server.c
   gnunet/src/multicast/gnunet-service-multicast.c
   gnunet/src/pt/gnunet-daemon-pt.c
   gnunet/src/rps/gnunet-service-rps.c
   gnunet/src/rps/gnunet-service-rps_peers.c
   gnunet/src/rps/gnunet-service-rps_peers.h
   gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
   gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
   gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c
   gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c
   gnunet/src/set/gnunet-service-set.c
   gnunet/src/vpn/gnunet-service-vpn.c
Log:
- fix CADET-using services

Modified: gnunet/src/conversation/gnunet-service-conversation.c
===================================================================
--- gnunet/src/conversation/gnunet-service-conversation.c       2016-07-20 
13:33:33 UTC (rev 37555)
+++ gnunet/src/conversation/gnunet-service-conversation.c       2016-07-20 
17:13:26 UTC (rev 37556)
@@ -720,7 +720,7 @@
   ch->channel_reliable = GNUNET_CADET_channel_create (cadet,
                                                      ch,
                                                      &msg->target,
-                                                     
GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL,
+                                                     GC_u2h 
(GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL),
                                                      
GNUNET_CADET_OPTION_RELIABLE);
   ch->reliable_mq = GNUNET_CADET_mq_create (ch->channel_reliable);
   e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_CADET_PHONE_RING);
@@ -1102,7 +1102,7 @@
   ch->channel_unreliable = GNUNET_CADET_channel_create (cadet,
                                                        ch,
                                                        &ch->target,
-                                                       
GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO,
+                                                       GC_u2h 
(GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO),
                                                        
GNUNET_CADET_OPTION_DEFAULT);
   if (NULL == ch->channel_unreliable)
   {
@@ -1351,13 +1351,14 @@
  */
 static void *
 inbound_channel (void *cls,
-                struct GNUNET_CADET_Channel *channel,
-               const struct GNUNET_PeerIdentity *initiator,
-                uint32_t port, enum GNUNET_CADET_ChannelOption options)
+                 struct GNUNET_CADET_Channel *channel,
+                 const struct GNUNET_PeerIdentity *initiator,
+                 const struct GNUNET_HashCode *port,
+                 enum GNUNET_CADET_ChannelOption options)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-             _("Received incoming Cadet channel on port %u\n"),
-              (unsigned int) port);
+              _("Received incoming Cadet channel on port %s\n"),
+              GNUNET_h2s (port));
   return NULL;
 }
 
@@ -1557,11 +1558,6 @@
      0},
     {NULL, 0, 0}
   };
-  static uint32_t ports[] = {
-    GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL,
-    GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO,
-    0
-  };
 
   cfg = c;
   GNUNET_assert (GNUNET_OK ==
@@ -1569,10 +1565,8 @@
                                                   &my_identity));
   cadet = GNUNET_CADET_connect (cfg,
                              NULL,
-                             &inbound_channel,
                              &inbound_end,
-                              cadet_handlers,
-                              ports);
+                              cadet_handlers);
 
   if (NULL == cadet)
   {
@@ -1580,6 +1574,14 @@
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+
+  GNUNET_CADET_open_port (cadet,
+                          GC_u2h 
(GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL),
+                          &inbound_channel, NULL);
+  GNUNET_CADET_open_port (cadet,
+                          GC_u2h (GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO),
+                          &inbound_channel, NULL);
+
   nc = GNUNET_SERVER_notification_context_create (server, 16);
   GNUNET_SERVER_add_handlers (server, server_handlers);
   GNUNET_SERVER_disconnect_notify (server,

Modified: gnunet/src/exit/gnunet-daemon-exit.c
===================================================================
--- gnunet/src/exit/gnunet-daemon-exit.c        2016-07-20 13:33:33 UTC (rev 
37555)
+++ gnunet/src/exit/gnunet-daemon-exit.c        2016-07-20 17:13:26 UTC (rev 
37556)
@@ -3036,7 +3036,7 @@
 new_channel (void *cls,
              struct GNUNET_CADET_Channel *channel,
              const struct GNUNET_PeerIdentity *initiator,
-             uint32_t port,
+             const struct GNUNET_HashCode *port,
              enum GNUNET_CADET_ChannelOption options)
 {
   struct ChannelState *s = GNUNET_new (struct ChannelState);
@@ -3760,16 +3760,20 @@
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
-  cadet_handle
-    = GNUNET_CADET_connect (cfg, NULL,
-                          &new_channel,
-                          &clean_channel, handlers,
-                           apptypes);
+  cadet_handle = GNUNET_CADET_connect (cfg, NULL, &clean_channel, handlers);
   if (NULL == cadet_handle)
   {
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  for (int i = 0;
+       GNUNET_APPLICATION_TYPE_END != apptypes[i]
+       && i < sizeof (apptypes)/sizeof (*apptypes);
+       i++)
+  {
+    GNUNET_CADET_open_port (cadet_handle, GC_u2h (apptypes[i]),
+                            &new_channel, NULL);
+  }
 
   /* Cadet handle acquired, now announce regular expressions matching our exit 
*/
   if ( (GNUNET_YES == ipv4_enabled) && (GNUNET_YES == ipv4_exit) )

Modified: gnunet/src/fs/gnunet-service-fs_cadet_client.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_cadet_client.c      2016-07-20 13:33:33 UTC 
(rev 37555)
+++ gnunet/src/fs/gnunet-service-fs_cadet_client.c      2016-07-20 17:13:26 UTC 
(rev 37556)
@@ -236,7 +236,7 @@
   mh->channel = GNUNET_CADET_channel_create (cadet_handle,
                                          mh,
                                          &mh->target,
-                                         
GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
+                                         GC_u2h 
(GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER),
                                          GNUNET_CADET_OPTION_RELIABLE);
   transmit_pending (mh);
 }
@@ -547,7 +547,7 @@
   mh->channel = GNUNET_CADET_channel_create (cadet_handle,
                                             mh,
                                             &mh->target,
-                                            
GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
+                                            GC_u2h 
(GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER),
                                             GNUNET_CADET_OPTION_RELIABLE);
   GNUNET_assert (mh ==
                  GNUNET_CONTAINER_multipeermap_get (cadet_map,
@@ -719,10 +719,8 @@
   cadet_map = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
   cadet_handle = GNUNET_CADET_connect (GSF_cfg,
                                     NULL,
-                                    NULL,
                                     &cleaner_cb,
-                                    handlers,
-                                    NULL);
+                                    handlers);
 }
 
 

Modified: gnunet/src/fs/gnunet-service-fs_cadet_server.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs_cadet_server.c      2016-07-20 13:33:33 UTC 
(rev 37555)
+++ gnunet/src/fs/gnunet-service-fs_cadet_server.c      2016-07-20 17:13:26 UTC 
(rev 37556)
@@ -472,7 +472,8 @@
 accept_cb (void *cls,
           struct GNUNET_CADET_Channel *channel,
           const struct GNUNET_PeerIdentity *initiator,
-          uint32_t port, enum GNUNET_CADET_ChannelOption options)
+          const struct GNUNET_HashCode *port,
+           enum GNUNET_CADET_ChannelOption options)
 {
   struct CadetClient *sc;
 
@@ -561,11 +562,6 @@
     { &request_cb, GNUNET_MESSAGE_TYPE_FS_CADET_QUERY, sizeof (struct 
CadetQueryMessage)},
     { NULL, 0, 0 }
   };
-  static const uint32_t ports[] = {
-    GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER,
-    0
-  };
-
   if (GNUNET_YES !=
       GNUNET_CONFIGURATION_get_value_number (GSF_cfg,
                                             "fs",
@@ -576,11 +572,13 @@
              "Initializing cadet FS server with a limit of %llu connections\n",
              sc_count_max);
   listen_channel = GNUNET_CADET_connect (GSF_cfg,
-                                      NULL,
-                                      &accept_cb,
-                                      &cleaner_cb,
-                                      handlers,
-                                      ports);
+                                         NULL,
+                                         &cleaner_cb,
+                                         handlers);
+  GNUNET_assert (NULL != listen_channel);
+  GNUNET_CADET_open_port (listen_channel,
+                          GC_u2h (GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER),
+                          &accept_cb, NULL);
 }
 
 

Modified: gnunet/src/multicast/gnunet-service-multicast.c
===================================================================
--- gnunet/src/multicast/gnunet-service-multicast.c     2016-07-20 13:33:33 UTC 
(rev 37555)
+++ gnunet/src/multicast/gnunet-service-multicast.c     2016-07-20 17:13:26 UTC 
(rev 37556)
@@ -789,7 +789,7 @@
   chn->direction = DIR_OUTGOING;
   chn->join_status = JOIN_WAITING;
   chn->channel = GNUNET_CADET_channel_create (cadet, chn, &chn->peer,
-                                              
GNUNET_APPLICATION_TYPE_MULTICAST,
+                                              GC_u2h 
(GNUNET_APPLICATION_TYPE_MULTICAST),
                                               GNUNET_CADET_OPTION_RELIABLE);
   GNUNET_CONTAINER_multihashmap_put (channels_out, &chn->group_pub_hash, chn,
                                      
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
@@ -1484,7 +1484,7 @@
 cadet_notify_channel_new (void *cls,
                           struct GNUNET_CADET_Channel *channel,
                           const struct GNUNET_PeerIdentity *initiator,
-                          uint32_t port,
+                          const struct GNUNET_HashCode *port,
                           enum GNUNET_CADET_ChannelOption options)
 {
   return NULL;
@@ -1810,12 +1810,6 @@
 
 
 /**
- * Listening ports for CADET.
- */
-static const uint32_t cadet_ports[] = { GNUNET_APPLICATION_TYPE_MULTICAST, 0 };
-
-
-/**
  * Connected to core service.
  */
 static void
@@ -1833,9 +1827,11 @@
   replay_req_client = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO);
 
   cadet = GNUNET_CADET_connect (cfg, NULL,
-                                &cadet_notify_channel_new,
                                 &cadet_notify_channel_end,
-                                cadet_handlers, cadet_ports);
+                                cadet_handlers);
+  GNUNET_assert (NULL != cadet);
+  GNUNET_CADET_open_port (cadet, GC_u2h (GNUNET_APPLICATION_TYPE_MULTICAST),
+                          &cadet_notify_channel_new, NULL);
 
   nc = GNUNET_SERVER_notification_context_create (server, 1);
   GNUNET_SERVER_add_handlers (server, server_handlers);

Modified: gnunet/src/pt/gnunet-daemon-pt.c
===================================================================
--- gnunet/src/pt/gnunet-daemon-pt.c    2016-07-20 13:33:33 UTC (rev 37555)
+++ gnunet/src/pt/gnunet-daemon-pt.c    2016-07-20 17:13:26 UTC (rev 37556)
@@ -351,7 +351,7 @@
        pos->cadet_channel = GNUNET_CADET_channel_create (cadet_handle,
                                                      pos,
                                                      &pos->peer,
-                                                     
GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER,
+                                                     GC_u2h 
(GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER),
                                                      
GNUNET_CADET_OPTION_DEFAULT);
        if (NULL == pos->cadet_channel)
        {
@@ -1288,9 +1288,9 @@
       GNUNET_SCHEDULER_shutdown ();
       return;
     }
-    cadet_handle = GNUNET_CADET_connect (cfg, NULL, NULL,
+    cadet_handle = GNUNET_CADET_connect (cfg, NULL,
                                       &cadet_channel_end_cb,
-                                      cadet_handlers, NULL);
+                                      cadet_handlers);
     if (NULL == cadet_handle)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,

Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2016-07-20 13:33:33 UTC (rev 37555)
+++ gnunet/src/rps/gnunet-service-rps.c 2016-07-20 17:13:26 UTC (rev 37556)
@@ -2334,14 +2334,15 @@
     {&handle_peer_pull_reply  , GNUNET_MESSAGE_TYPE_RPS_PP_PULL_REPLY  , 0},
     {NULL, 0, 0}
   };
-  const uint32_t ports[] = {GNUNET_RPS_CADET_PORT, 0}; // _PORT specified in 
src/rps/rps.h
   cadet_handle = GNUNET_CADET_connect (cfg,
                                        cls,
-                                       &Peers_handle_inbound_channel,
                                        &cleanup_destroyed_channel,
-                                       cadet_handlers,
-                                       ports);
+                                       cadet_handlers);
+  GNUNET_assert (NULL != cadet_handle);
+  GNUNET_CADET_open_port (cadet_handle, GC_u2h (GNUNET_RPS_CADET_PORT),
+                          &Peers_handle_inbound_channel, cls);
 
+
   peerinfo_handle = GNUNET_PEERINFO_connect (cfg);
   Peers_initialise (fn_valid_peers, cadet_handle, &own_identity);
   GNUNET_free (fn_valid_peers);

Modified: gnunet/src/rps/gnunet-service-rps_peers.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps_peers.c   2016-07-20 13:33:33 UTC (rev 
37555)
+++ gnunet/src/rps/gnunet-service-rps_peers.c   2016-07-20 17:13:26 UTC (rev 
37556)
@@ -174,7 +174,7 @@
    * Identity of the peer
    */
   struct GNUNET_PeerIdentity peer_id;
-  
+
   /**
    * Flags indicating status of peer
    */
@@ -506,7 +506,7 @@
       GNUNET_CADET_channel_create (cadet_handle,
                                    peer_ctx->send_channel_flags, /* context */
                                    peer,
-                                   GNUNET_RPS_CADET_PORT,
+                                   GC_u2h (GNUNET_RPS_CADET_PORT),
                                    GNUNET_CADET_OPTION_RELIABLE);
   }
   GNUNET_assert (NULL != peer_ctx->send_channel);
@@ -518,7 +518,7 @@
  *
  * If we already have a message queue open to this client,
  * simply return it, otherways create one.
- * 
+ *
  * @param peer the peer to get the mq to
  * @return the #GNUNET_MQ_Handle
  */
@@ -1086,7 +1086,7 @@
 
   // TODO actually remove unnecessary data
 
-  if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) 
+  if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
   {
     return GNUNET_NO;
   }
@@ -1104,7 +1104,7 @@
 
 /**
  * @brief Remove peer
- * 
+ *
  * @param peer the peer to clean
  * @return #GNUNET_YES if peer was removed
  *         #GNUNET_NO  otherwise
@@ -1114,7 +1114,7 @@
 {
   struct PeerContext *peer_ctx;
 
-  if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) 
+  if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
   {
     return GNUNET_NO;
   }
@@ -1350,7 +1350,7 @@
 Peers_handle_inbound_channel (void *cls,
                               struct GNUNET_CADET_Channel *channel,
                               const struct GNUNET_PeerIdentity *initiator,
-                              uint32_t port,
+                              const struct GNUNET_HashCode *port,
                               enum GNUNET_CADET_ChannelOption options)
 {
   struct PeerContext *peer_ctx;

Modified: gnunet/src/rps/gnunet-service-rps_peers.h
===================================================================
--- gnunet/src/rps/gnunet-service-rps_peers.h   2016-07-20 13:33:33 UTC (rev 
37555)
+++ gnunet/src/rps/gnunet-service-rps_peers.h   2016-07-20 17:13:26 UTC (rev 
37556)
@@ -173,7 +173,7 @@
 
 /**
  * @brief Remove unecessary data
- * 
+ *
  * If the other peer is not intending to send messages, we have messages 
pending
  * to be sent to this peer and we are not waiting for a reply, remove the
  * information about it (its #PeerContext).
@@ -187,7 +187,7 @@
 
 /**
  * @brief Remove peer
- * 
+ *
  * @param peer the peer to clean
  * @return #GNUNET_YES if peer was removed
  *         #GNUNET_NO  otherwise
@@ -320,7 +320,7 @@
 Peers_handle_inbound_channel (void *cls,
                               struct GNUNET_CADET_Channel *channel,
                               const struct GNUNET_PeerIdentity *initiator,
-                              uint32_t port,
+                              const struct GNUNET_HashCode *port,
                               enum GNUNET_CADET_ChannelOption options);
 
 /**

Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c   
2016-07-20 13:33:33 UTC (rev 37555)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c   
2016-07-20 17:13:26 UTC (rev 37556)
@@ -858,7 +858,7 @@
     = GNUNET_CADET_channel_create (my_cadet,
                                    s,
                                    &s->peer,
-                                   GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC,
+                                   GC_u2h 
(GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC),
                                    GNUNET_CADET_OPTION_RELIABLE);
   if (NULL == s->channel)
   {
@@ -1184,10 +1184,8 @@
                                    &handle_client_disconnect,
                                    NULL);
   my_cadet = GNUNET_CADET_connect (cfg, NULL,
-                                   NULL /* no incoming supported */,
                                    &cb_channel_destruction,
-                                   cadet_handlers,
-                                   NULL);
+                                   cadet_handlers);
   if (NULL == my_cadet)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,

Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c     
2016-07-20 13:33:33 UTC (rev 37555)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c     
2016-07-20 17:13:26 UTC (rev 37556)
@@ -891,7 +891,7 @@
 cb_channel_incoming (void *cls,
                      struct GNUNET_CADET_Channel *channel,
                      const struct GNUNET_PeerIdentity *initiator,
-                     uint32_t port,
+                     const struct GNUNET_HashCode *port,
                      enum GNUNET_CADET_ChannelOption options)
 {
   struct CadetIncomingSession *in;
@@ -1221,10 +1221,6 @@
       0},
     { NULL, 0, 0}
   };
-  static const uint32_t ports[] = {
-    GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC,
-    0
-  };
 
   cfg = c;
   /* We don't really do DLOG, so we can setup with very minimal resources */
@@ -1241,10 +1237,8 @@
   cadet_sessions = GNUNET_CONTAINER_multihashmap_create (128,
                                                          GNUNET_YES);
   my_cadet = GNUNET_CADET_connect (cfg, NULL,
-                                   &cb_channel_incoming,
                                    &cb_channel_destruction,
-                                   cadet_handlers,
-                                   ports);
+                                   cadet_handlers);
   if (NULL == my_cadet)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1252,6 +1246,9 @@
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  GNUNET_CADET_open_port (my_cadet,
+                          GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC),
+                          &cb_channel_incoming, NULL);
   GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
                                 NULL);
 }

Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c       
2016-07-20 13:33:33 UTC (rev 37555)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c       
2016-07-20 17:13:26 UTC (rev 37556)
@@ -1081,7 +1081,7 @@
     = GNUNET_CADET_channel_create (my_cadet,
                                    s,
                                    &s->peer,
-                                   GNUNET_APPLICATION_TYPE_SCALARPRODUCT,
+                                   GC_u2h 
(GNUNET_APPLICATION_TYPE_SCALARPRODUCT),
                                    GNUNET_CADET_OPTION_RELIABLE);
   if (NULL == s->channel)
   {
@@ -1409,10 +1409,8 @@
                                    &handle_client_disconnect,
                                    NULL);
   my_cadet = GNUNET_CADET_connect (cfg, NULL,
-                                   NULL /* no incoming supported */,
                                    &cb_channel_destruction,
-                                   cadet_handlers,
-                                   NULL);
+                                   cadet_handlers);
   if (NULL == my_cadet)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,

Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c 2016-07-20 
13:33:33 UTC (rev 37555)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c 2016-07-20 
17:13:26 UTC (rev 37556)
@@ -1187,7 +1187,7 @@
 cb_channel_incoming (void *cls,
                      struct GNUNET_CADET_Channel *channel,
                      const struct GNUNET_PeerIdentity *initiator,
-                     uint32_t port,
+                     const struct GNUNET_HashCode *port,
                      enum GNUNET_CADET_ChannelOption options)
 {
   struct CadetIncomingSession *in;
@@ -1512,10 +1512,6 @@
       0},
     { NULL, 0, 0}
   };
-  static const uint32_t ports[] = {
-    GNUNET_APPLICATION_TYPE_SCALARPRODUCT,
-    0
-  };
 
   cfg = c;
   /*
@@ -1538,10 +1534,8 @@
   cadet_sessions = GNUNET_CONTAINER_multihashmap_create (128,
                                                          GNUNET_YES);
   my_cadet = GNUNET_CADET_connect (cfg, NULL,
-                                   &cb_channel_incoming,
                                    &cb_channel_destruction,
-                                   cadet_handlers,
-                                   ports);
+                                   cadet_handlers);
   if (NULL == my_cadet)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1549,6 +1543,9 @@
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  GNUNET_CADET_open_port (my_cadet,
+                          GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT),
+                          &cb_channel_incoming, NULL);
   GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
                                 NULL);
 }

Modified: gnunet/src/set/gnunet-service-set.c
===================================================================
--- gnunet/src/set/gnunet-service-set.c 2016-07-20 13:33:33 UTC (rev 37555)
+++ gnunet/src/set/gnunet-service-set.c 2016-07-20 17:13:26 UTC (rev 37556)
@@ -1358,7 +1358,7 @@
   op->channel = GNUNET_CADET_channel_create (cadet,
                                              op,
                                              &msg->target_peer,
-                                             GNUNET_APPLICATION_TYPE_SET,
+                                             GC_u2h 
(GNUNET_APPLICATION_TYPE_SET),
                                              GNUNET_CADET_OPTION_RELIABLE);
   op->mq = GNUNET_CADET_mq_create (op->channel);
   set->vt->evaluate (op,
@@ -1796,7 +1796,7 @@
 channel_new_cb (void *cls,
                 struct GNUNET_CADET_Channel *channel,
                 const struct GNUNET_PeerIdentity *initiator,
-                uint32_t port,
+                const struct GNUNET_HashCode *port,
                 enum GNUNET_CADET_ChannelOption options)
 {
   static const struct SetVT incoming_vt = {
@@ -1805,7 +1805,7 @@
   };
   struct Operation *incoming;
 
-  if (GNUNET_APPLICATION_TYPE_SET != port)
+  if (0 != memcmp (GC_u2h (GNUNET_APPLICATION_TYPE_SET), port, sizeof (*port)))
   {
     GNUNET_break (0);
     GNUNET_CADET_channel_destroy (channel);
@@ -1988,7 +1988,6 @@
     { &dispatch_p2p_message, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE, 0},
     {NULL, 0, 0}
   };
-  static const uint32_t cadet_ports[] = {GNUNET_APPLICATION_TYPE_SET, 0};
 
   configuration = cfg;
   GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
@@ -1998,10 +1997,11 @@
                               server_handlers);
   _GSS_statistics = GNUNET_STATISTICS_create ("set", cfg);
   cadet = GNUNET_CADET_connect (cfg, NULL,
-                                &channel_new_cb,
                                 &channel_end_cb,
-                                cadet_handlers,
-                                cadet_ports);
+                                cadet_handlers);
+  GNUNET_CADET_open_port (cadet,
+                          GC_u2h (GNUNET_APPLICATION_TYPE_SET),
+                          &channel_new_cb, NULL);
   if (NULL == cadet)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,

Modified: gnunet/src/vpn/gnunet-service-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-service-vpn.c 2016-07-20 13:33:33 UTC (rev 37555)
+++ gnunet/src/vpn/gnunet-service-vpn.c 2016-07-20 17:13:26 UTC (rev 37556)
@@ -758,7 +758,7 @@
   ts->channel = GNUNET_CADET_channel_create (cadet_handle,
                                              ts,
                                              id,
-                                             apptype,
+                                             GC_u2h (apptype),
                                              GNUNET_CADET_OPTION_DEFAULT);
 }
 
@@ -801,7 +801,7 @@
     ts->channel = GNUNET_CADET_channel_create (cadet_handle,
                                                ts,
                                                
&dt->destination->details.service_destination.target,
-                                               apptype,
+                                               GC_u2h (apptype),
                                                GNUNET_CADET_OPTION_DEFAULT);
     if (NULL == ts->channel)
     {
@@ -3090,10 +3090,9 @@
 
   cadet_handle =
     GNUNET_CADET_connect (cfg_, NULL,
-                          NULL,
                           &channel_cleaner,
-                          cadet_handlers,
-                          NULL);
+                          cadet_handlers);
+    // FIXME never opens ports???
   helper_handle = GNUNET_HELPER_start (GNUNET_NO,
                                       "gnunet-helper-vpn", vpn_argv,
                                       &message_token, NULL, NULL);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]