gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r33777 - gnunet/src/transport
Date: Mon, 23 Jun 2014 13:11:40 +0200

Author: grothoff
Date: 2014-06-23 13:11:40 +0200 (Mon, 23 Jun 2014)
New Revision: 33777

Modified:
   gnunet/src/transport/plugin_transport_tcp.c
Log:
make myoptions member of 'struct Plugin' instead of a global

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2014-06-23 11:08:12 UTC (rev 
33776)
+++ gnunet/src/transport/plugin_transport_tcp.c 2014-06-23 11:11:40 UTC (rev 
33777)
@@ -49,10 +49,6 @@
 
 GNUNET_NETWORK_STRUCT_BEGIN
 
-/**
- * Address options
- */
-static uint32_t myoptions;
 
 /**
  * Initial handshake message for a session.
@@ -397,6 +393,11 @@
   GNUNET_SCHEDULER_TaskIdentifier address_update_task;
 
   /**
+   * Address options
+   */
+  uint32_t myoptions;
+
+  /**
    * Port that we are actually listening on.
    */
   uint16_t open_port;
@@ -486,7 +487,7 @@
   case AF_INET:
     GNUNET_assert(addrlen == sizeof(struct sockaddr_in));
     memset (&t4, 0, sizeof(t4));
-    t4.options = htonl (myoptions);
+    t4.options = htonl (plugin->myoptions);
     t4.ipv4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
     t4.t4_port = ((struct sockaddr_in *) addr)->sin_port;
     arg = &t4;
@@ -497,7 +498,7 @@
     memset (&t6, 0, sizeof(t6));
     memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr,
         sizeof(struct in6_addr));
-    t6.options = htonl (myoptions);
+    t6.options = htonl (plugin->myoptions);
     t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port;
     arg = &t6;
     args = sizeof (t6);
@@ -1896,7 +1897,9 @@
   if (addrlen == sizeof(struct IPv4TcpAddress))
   {
     v4 = (struct IPv4TcpAddress *) addr;
-    if (0 != memcmp (&v4->options, &myoptions, sizeof(myoptions)))
+    if (0 != memcmp (&v4->options,
+                     &plugin->myoptions,
+                     sizeof(uint32_t)))
     {
       GNUNET_break(0);
       return GNUNET_SYSERR;
@@ -1916,7 +1919,9 @@
       GNUNET_break_op(0);
       return GNUNET_SYSERR;
     }
-    if (0 != memcmp (&v6->options, &myoptions, sizeof(myoptions)))
+    if (0 != memcmp (&v6->options,
+                     &plugin->myoptions,
+                     sizeof (uint32_t)))
     {
       GNUNET_break(0);
       return GNUNET_SYSERR;
@@ -2511,18 +2516,13 @@
   else
     service = NULL;
 
-  /* Initialize my flags */
-  myoptions = 0;
-
   plugin = GNUNET_new (struct Plugin);
   plugin->sessionmap = GNUNET_CONTAINER_multipeermap_create (max_connections,
       GNUNET_YES);
   plugin->max_connections = max_connections;
-  plugin->cur_connections = 0;
   plugin->open_port = bport;
   plugin->adv_port = aport;
   plugin->env = env;
-  plugin->lsock = NULL;
   if ( (service != NULL) &&
        (GNUNET_SYSERR !=
         (ret_s =




reply via email to

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