gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r34408 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r34408 - gnunet/src/transport
Date: Sat, 22 Nov 2014 19:57:36 +0100

Author: grothoff
Date: 2014-11-22 19:57:36 +0100 (Sat, 22 Nov 2014)
New Revision: 34408

Modified:
   gnunet/src/transport/plugin_transport_tcp.c
   gnunet/src/transport/transport_api_monitor_plugins.c
Log:
-move welcome creation to startup

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2014-11-21 12:43:20 UTC (rev 
34407)
+++ gnunet/src/transport/plugin_transport_tcp.c 2014-11-22 18:57:36 UTC (rev 
34408)
@@ -418,6 +418,11 @@
   void *sic_cls;
 
   /**
+   * Welcome message used by this peer.
+   */
+  struct WelcomeMessage my_welcome;
+
+  /**
    * How many more TCP sessions are we allowed to open right now?
    */
   unsigned long long max_connections;
@@ -990,7 +995,6 @@
 {
   struct Session *session;
   struct PendingMessage *pm;
-  struct WelcomeMessage welcome;
 
   if (GNUNET_YES != is_nat)
     GNUNET_assert (NULL != client);
@@ -1013,14 +1017,13 @@
       sizeof (struct WelcomeMessage));
   pm->msg = (const char *) &pm[1];
   pm->message_size = sizeof(struct WelcomeMessage);
-  welcome.header.size = htons (sizeof(struct WelcomeMessage));
-  welcome.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME);
-  welcome.clientIdentity = *plugin->env->my_identity;
-  memcpy (&pm[1], &welcome, sizeof(welcome));
+  memcpy (&pm[1],
+          &plugin->my_welcome,
+          sizeof(struct WelcomeMessage));
   pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
   GNUNET_STATISTICS_update (plugin->env->stats,
-      gettext_noop ("# bytes currently in TCP buffers"), pm->message_size,
-      GNUNET_NO);
+                            gettext_noop ("# bytes currently in TCP buffers"), 
pm->message_size,
+                            GNUNET_NO);
   GNUNET_CONTAINER_DLL_insert (session->pending_messages_head,
                                session->pending_messages_tail,
                                pm);
@@ -2773,6 +2776,9 @@
   plugin->open_port = bport;
   plugin->adv_port = aport;
   plugin->env = env;
+  plugin->my_welcome.header.size = htons (sizeof(struct WelcomeMessage));
+  plugin->my_welcome.header.type = htons 
(GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME);
+  plugin->my_welcome.clientIdentity = *plugin->env->my_identity;
 
   if ( (NULL != service) &&
        (GNUNET_YES ==

Modified: gnunet/src/transport/transport_api_monitor_plugins.c
===================================================================
--- gnunet/src/transport/transport_api_monitor_plugins.c        2014-11-21 
12:43:20 UTC (rev 34407)
+++ gnunet/src/transport/transport_api_monitor_plugins.c        2014-11-22 
18:57:36 UTC (rev 34408)
@@ -391,7 +391,8 @@
   struct GNUNET_TRANSPORT_PluginMonitor *pm;
   struct GNUNET_CLIENT_Connection *client;
 
-  client = GNUNET_CLIENT_connect ("transport", cfg);
+  client = GNUNET_CLIENT_connect ("transport",
+                                  cfg);
   if (NULL == client)
     return NULL;
   pm = GNUNET_new (struct GNUNET_TRANSPORT_PluginMonitor);




reply via email to

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