diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-11-22 18:57:36 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-11-22 18:57:36 +0000 |
commit | bdf9207c5a89a0af9c3967c5fd8ff3a66ccebdb6 (patch) | |
tree | 5a69077df372dbdc4ae0a7b3995eaa92e83f34f3 /src/transport | |
parent | 59d9c80164bb116a215779c6bef4018336e8f146 (diff) | |
download | gnunet-bdf9207c5a89a0af9c3967c5fd8ff3a66ccebdb6.tar.gz gnunet-bdf9207c5a89a0af9c3967c5fd8ff3a66ccebdb6.zip |
-move welcome creation to startup
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 20 | ||||
-rw-r--r-- | src/transport/transport_api_monitor_plugins.c | 3 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 4c2691e09..501aea15a 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -418,6 +418,11 @@ struct Plugin | |||
418 | void *sic_cls; | 418 | void *sic_cls; |
419 | 419 | ||
420 | /** | 420 | /** |
421 | * Welcome message used by this peer. | ||
422 | */ | ||
423 | struct WelcomeMessage my_welcome; | ||
424 | |||
425 | /** | ||
421 | * How many more TCP sessions are we allowed to open right now? | 426 | * How many more TCP sessions are we allowed to open right now? |
422 | */ | 427 | */ |
423 | unsigned long long max_connections; | 428 | unsigned long long max_connections; |
@@ -990,7 +995,6 @@ create_session (struct Plugin *plugin, | |||
990 | { | 995 | { |
991 | struct Session *session; | 996 | struct Session *session; |
992 | struct PendingMessage *pm; | 997 | struct PendingMessage *pm; |
993 | struct WelcomeMessage welcome; | ||
994 | 998 | ||
995 | if (GNUNET_YES != is_nat) | 999 | if (GNUNET_YES != is_nat) |
996 | GNUNET_assert (NULL != client); | 1000 | GNUNET_assert (NULL != client); |
@@ -1013,14 +1017,13 @@ create_session (struct Plugin *plugin, | |||
1013 | sizeof (struct WelcomeMessage)); | 1017 | sizeof (struct WelcomeMessage)); |
1014 | pm->msg = (const char *) &pm[1]; | 1018 | pm->msg = (const char *) &pm[1]; |
1015 | pm->message_size = sizeof(struct WelcomeMessage); | 1019 | pm->message_size = sizeof(struct WelcomeMessage); |
1016 | welcome.header.size = htons (sizeof(struct WelcomeMessage)); | 1020 | memcpy (&pm[1], |
1017 | welcome.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME); | 1021 | &plugin->my_welcome, |
1018 | welcome.clientIdentity = *plugin->env->my_identity; | 1022 | sizeof(struct WelcomeMessage)); |
1019 | memcpy (&pm[1], &welcome, sizeof(welcome)); | ||
1020 | pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; | 1023 | pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; |
1021 | GNUNET_STATISTICS_update (plugin->env->stats, | 1024 | GNUNET_STATISTICS_update (plugin->env->stats, |
1022 | gettext_noop ("# bytes currently in TCP buffers"), pm->message_size, | 1025 | gettext_noop ("# bytes currently in TCP buffers"), pm->message_size, |
1023 | GNUNET_NO); | 1026 | GNUNET_NO); |
1024 | GNUNET_CONTAINER_DLL_insert (session->pending_messages_head, | 1027 | GNUNET_CONTAINER_DLL_insert (session->pending_messages_head, |
1025 | session->pending_messages_tail, | 1028 | session->pending_messages_tail, |
1026 | pm); | 1029 | pm); |
@@ -2773,6 +2776,9 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
2773 | plugin->open_port = bport; | 2776 | plugin->open_port = bport; |
2774 | plugin->adv_port = aport; | 2777 | plugin->adv_port = aport; |
2775 | plugin->env = env; | 2778 | plugin->env = env; |
2779 | plugin->my_welcome.header.size = htons (sizeof(struct WelcomeMessage)); | ||
2780 | plugin->my_welcome.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_TCP_WELCOME); | ||
2781 | plugin->my_welcome.clientIdentity = *plugin->env->my_identity; | ||
2776 | 2782 | ||
2777 | if ( (NULL != service) && | 2783 | if ( (NULL != service) && |
2778 | (GNUNET_YES == | 2784 | (GNUNET_YES == |
diff --git a/src/transport/transport_api_monitor_plugins.c b/src/transport/transport_api_monitor_plugins.c index 055228fa8..04e5b268c 100644 --- a/src/transport/transport_api_monitor_plugins.c +++ b/src/transport/transport_api_monitor_plugins.c | |||
@@ -391,7 +391,8 @@ GNUNET_TRANSPORT_monitor_plugins (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
391 | struct GNUNET_TRANSPORT_PluginMonitor *pm; | 391 | struct GNUNET_TRANSPORT_PluginMonitor *pm; |
392 | struct GNUNET_CLIENT_Connection *client; | 392 | struct GNUNET_CLIENT_Connection *client; |
393 | 393 | ||
394 | client = GNUNET_CLIENT_connect ("transport", cfg); | 394 | client = GNUNET_CLIENT_connect ("transport", |
395 | cfg); | ||
395 | if (NULL == client) | 396 | if (NULL == client) |
396 | return NULL; | 397 | return NULL; |
397 | pm = GNUNET_new (struct GNUNET_TRANSPORT_PluginMonitor); | 398 | pm = GNUNET_new (struct GNUNET_TRANSPORT_PluginMonitor); |