diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-23 11:11:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-23 11:11:40 +0000 |
commit | 30d89ade90a0d0ae3a3581adbd6110bf7db9b35a (patch) | |
tree | 9cc4495ace16f4cebd7469ed898782beda173659 | |
parent | 844776ae1b6d1beb0af2e93a672d4681a9f7d51c (diff) | |
download | gnunet-30d89ade90a0d0ae3a3581adbd6110bf7db9b35a.tar.gz gnunet-30d89ade90a0d0ae3a3581adbd6110bf7db9b35a.zip |
make myoptions member of 'struct Plugin' instead of a global
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 31100d748..4d9ab1b41 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -49,10 +49,6 @@ | |||
49 | 49 | ||
50 | GNUNET_NETWORK_STRUCT_BEGIN | 50 | GNUNET_NETWORK_STRUCT_BEGIN |
51 | 51 | ||
52 | /** | ||
53 | * Address options | ||
54 | */ | ||
55 | static uint32_t myoptions; | ||
56 | 52 | ||
57 | /** | 53 | /** |
58 | * Initial handshake message for a session. | 54 | * Initial handshake message for a session. |
@@ -397,6 +393,11 @@ struct Plugin | |||
397 | GNUNET_SCHEDULER_TaskIdentifier address_update_task; | 393 | GNUNET_SCHEDULER_TaskIdentifier address_update_task; |
398 | 394 | ||
399 | /** | 395 | /** |
396 | * Address options | ||
397 | */ | ||
398 | uint32_t myoptions; | ||
399 | |||
400 | /** | ||
400 | * Port that we are actually listening on. | 401 | * Port that we are actually listening on. |
401 | */ | 402 | */ |
402 | uint16_t open_port; | 403 | uint16_t open_port; |
@@ -486,7 +487,7 @@ tcp_nat_port_map_callback (void *cls, | |||
486 | case AF_INET: | 487 | case AF_INET: |
487 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in)); | 488 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in)); |
488 | memset (&t4, 0, sizeof(t4)); | 489 | memset (&t4, 0, sizeof(t4)); |
489 | t4.options = htonl (myoptions); | 490 | t4.options = htonl (plugin->myoptions); |
490 | t4.ipv4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr; | 491 | t4.ipv4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr; |
491 | t4.t4_port = ((struct sockaddr_in *) addr)->sin_port; | 492 | t4.t4_port = ((struct sockaddr_in *) addr)->sin_port; |
492 | arg = &t4; | 493 | arg = &t4; |
@@ -497,7 +498,7 @@ tcp_nat_port_map_callback (void *cls, | |||
497 | memset (&t6, 0, sizeof(t6)); | 498 | memset (&t6, 0, sizeof(t6)); |
498 | memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr, | 499 | memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr, |
499 | sizeof(struct in6_addr)); | 500 | sizeof(struct in6_addr)); |
500 | t6.options = htonl (myoptions); | 501 | t6.options = htonl (plugin->myoptions); |
501 | t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; | 502 | t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; |
502 | arg = &t6; | 503 | arg = &t6; |
503 | args = sizeof (t6); | 504 | args = sizeof (t6); |
@@ -1896,7 +1897,9 @@ tcp_plugin_check_address (void *cls, const void *addr, size_t addrlen) | |||
1896 | if (addrlen == sizeof(struct IPv4TcpAddress)) | 1897 | if (addrlen == sizeof(struct IPv4TcpAddress)) |
1897 | { | 1898 | { |
1898 | v4 = (struct IPv4TcpAddress *) addr; | 1899 | v4 = (struct IPv4TcpAddress *) addr; |
1899 | if (0 != memcmp (&v4->options, &myoptions, sizeof(myoptions))) | 1900 | if (0 != memcmp (&v4->options, |
1901 | &plugin->myoptions, | ||
1902 | sizeof(uint32_t))) | ||
1900 | { | 1903 | { |
1901 | GNUNET_break(0); | 1904 | GNUNET_break(0); |
1902 | return GNUNET_SYSERR; | 1905 | return GNUNET_SYSERR; |
@@ -1916,7 +1919,9 @@ tcp_plugin_check_address (void *cls, const void *addr, size_t addrlen) | |||
1916 | GNUNET_break_op(0); | 1919 | GNUNET_break_op(0); |
1917 | return GNUNET_SYSERR; | 1920 | return GNUNET_SYSERR; |
1918 | } | 1921 | } |
1919 | if (0 != memcmp (&v6->options, &myoptions, sizeof(myoptions))) | 1922 | if (0 != memcmp (&v6->options, |
1923 | &plugin->myoptions, | ||
1924 | sizeof (uint32_t))) | ||
1920 | { | 1925 | { |
1921 | GNUNET_break(0); | 1926 | GNUNET_break(0); |
1922 | return GNUNET_SYSERR; | 1927 | return GNUNET_SYSERR; |
@@ -2511,18 +2516,13 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
2511 | else | 2516 | else |
2512 | service = NULL; | 2517 | service = NULL; |
2513 | 2518 | ||
2514 | /* Initialize my flags */ | ||
2515 | myoptions = 0; | ||
2516 | |||
2517 | plugin = GNUNET_new (struct Plugin); | 2519 | plugin = GNUNET_new (struct Plugin); |
2518 | plugin->sessionmap = GNUNET_CONTAINER_multipeermap_create (max_connections, | 2520 | plugin->sessionmap = GNUNET_CONTAINER_multipeermap_create (max_connections, |
2519 | GNUNET_YES); | 2521 | GNUNET_YES); |
2520 | plugin->max_connections = max_connections; | 2522 | plugin->max_connections = max_connections; |
2521 | plugin->cur_connections = 0; | ||
2522 | plugin->open_port = bport; | 2523 | plugin->open_port = bport; |
2523 | plugin->adv_port = aport; | 2524 | plugin->adv_port = aport; |
2524 | plugin->env = env; | 2525 | plugin->env = env; |
2525 | plugin->lsock = NULL; | ||
2526 | if ( (service != NULL) && | 2526 | if ( (service != NULL) && |
2527 | (GNUNET_SYSERR != | 2527 | (GNUNET_SYSERR != |
2528 | (ret_s = | 2528 | (ret_s = |