summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-25 21:08:22 +0000
committerChristian Grothoff <christian@grothoff.org>2015-01-25 21:08:22 +0000
commit260d4269dd93fd8e4e5af766e15970251c5b7ac9 (patch)
tree6b2b7ac3e1ba4224791518a38276efdd9729bb65
parentee266d0bd0b96c67ac1c7f76fff41980bb181e64 (diff)
-undo bad commit
-rw-r--r--src/transport/gnunet-service-transport.c15
-rw-r--r--src/transport/gnunet-service-transport_ats.c34
-rw-r--r--src/transport/gnunet-service-transport_ats.h11
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c10
-rw-r--r--src/transport/plugin_transport_tcp.c46
-rw-r--r--src/transport/plugin_transport_udp.c33
-rw-r--r--src/transport/plugin_transport_wlan.c41
-rw-r--r--src/transport/test_transport_api_reliability.c16
8 files changed, 68 insertions, 138 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index b21b0c384..5126dad96 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -732,15 +732,11 @@ plugin_env_session_start (void *cls,
session,
GNUNET_i2s (&address->peer),
GST_plugins_a2s (address));
- if ( (GNUNET_YES ==
- GNUNET_HELLO_address_check_option (address,
- GNUNET_HELLO_ADDRESS_INFO_INBOUND)) ||
- (GNUNET_NO ==
- GST_ats_is_known (address, session) ) )
+ if (GNUNET_YES ==
+ GNUNET_HELLO_address_check_option (address,
+ GNUNET_HELLO_ADDRESS_INFO_INBOUND))
{
- /* inbound is always new, but outbound MAY already be known, but
- for example for UNIX, we have symmetric connections and thus we
- may not know the address yet; add if necessary! */
+ /* inbound is always new */
GST_ats_add_address (address,
session,
ats,
@@ -748,6 +744,7 @@ plugin_env_session_start (void *cls,
}
else
{
+ /* outbound should already be known */
GST_ats_new_session (address,
session);
GST_ats_update_metrics (address,
@@ -926,8 +923,8 @@ shutdown_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GST_neighbours_stop ();
- GST_plugins_unload ();
GST_validation_stop ();
+ GST_plugins_unload ();
GST_ats_done ();
GNUNET_ATS_scheduling_done (GST_ats);
GST_ats = NULL;
diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c
index a660f252f..4fcf7c9dc 100644
--- a/src/transport/gnunet-service-transport_ats.c
+++ b/src/transport/gnunet-service-transport_ats.c
@@ -108,8 +108,6 @@ find_ai_cb (void *cls,
fc->ret = ai;
return GNUNET_NO;
}
- GNUNET_assert ( (fc->session != ai->session) ||
- (NULL == ai->session) );
return GNUNET_YES;
}
@@ -140,21 +138,6 @@ find_ai (const struct GNUNET_HELLO_Address *address,
/**
- * Test if ATS knows about this address.
- *
- * @param address the address
- * @param session the session
- * @return #GNUNET_YES if address is known, #GNUNET_NO if not.
- */
-int
-GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
- struct Session *session)
-{
- return (NULL != find_ai (address, session)) ? GNUNET_YES : GNUNET_NO;
-}
-
-
-/**
* Notify ATS about the new address including the network this address is
* located in.
*
@@ -200,7 +183,7 @@ GST_ats_add_address (const struct GNUNET_HELLO_Address *address,
if (NULL == (papi = GST_plugins_find (address->transport_name)))
{
/* we don't have the plugin for this address */
- GNUNET_assert (0);
+ GNUNET_break(0);
return;
}
if (NULL != session)
@@ -261,12 +244,7 @@ GST_ats_new_session (const struct GNUNET_HELLO_Address *address,
ai = find_ai (address, NULL);
if (NULL == ai)
{
- /* We may already be aware of the session, even if some other part
- of the code could not tell if it just created a new session or
- just got one recycled from the plugin; hence, we may be called
- with "new" session even for an "old" session; in that case,
- check that this is the case, but just ignore it. */
- GNUNET_assert (NULL != (find_ai (address, session)));
+ GNUNET_break (NULL != (find_ai (address, session)));
return;
}
GNUNET_break (NULL == ai->session);
@@ -352,9 +330,9 @@ GST_ats_update_metrics (const struct GNUNET_HELLO_Address *address,
and if we get metrics for those, they were never known to
ATS which means we end up here (however, in this
case, the address must be an outbound address). */
- GNUNET_assert (GNUNET_YES !=
- GNUNET_HELLO_address_check_option (address,
- GNUNET_HELLO_ADDRESS_INFO_INBOUND));
+ GNUNET_break (GNUNET_YES !=
+ GNUNET_HELLO_address_check_option (address,
+ GNUNET_HELLO_ADDRESS_INFO_INBOUND));
return;
}
@@ -416,7 +394,7 @@ GST_ats_expire_address (const struct GNUNET_HELLO_Address *address)
ai = find_ai (address, NULL);
if (NULL == ai)
{
- GNUNET_assert (0);
+ GNUNET_break (0);
return;
}
GNUNET_assert (GNUNET_YES ==
diff --git a/src/transport/gnunet-service-transport_ats.h b/src/transport/gnunet-service-transport_ats.h
index b203cc323..b066ad74f 100644
--- a/src/transport/gnunet-service-transport_ats.h
+++ b/src/transport/gnunet-service-transport_ats.h
@@ -51,17 +51,6 @@ GST_ats_done (void);
/**
- * Test if ATS knows about this address.
- *
- * @param address the address
- * @param session the session
- * @return #GNUNET_YES if address is known, #GNUNET_NO if not.
- */
-int
-GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
- struct Session *session);
-
-/**
* Notify ATS about the new address including the network this address is
* located in.
*
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index e13bca139..c7459680f 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -800,11 +800,11 @@ set_alternative_address (struct NeighbourMapEntry *n,
*/
static void
set_primary_address (struct NeighbourMapEntry *n,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- int is_active)
+ const struct GNUNET_HELLO_Address *address,
+ struct Session *session,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
+ struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+ int is_active)
{
struct GNUNET_TRANSPORT_PluginFunctions *papi;
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 770525f21..01a4eade8 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -2261,9 +2261,8 @@ handle_tcp_welcome (void *cls,
struct GNUNET_ATS_Information ats;
- if (0 == memcmp (&wm->clientIdentity,
- plugin->env->my_identity,
- sizeof(struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (&wm->clientIdentity, plugin->env->my_identity,
+ sizeof(struct GNUNET_PeerIdentity)))
{
/* refuse connections from ourselves */
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
@@ -2278,14 +2277,10 @@ handle_tcp_welcome (void *cls,
return;
}
- LOG(GNUNET_ERROR_TYPE_DEBUG,
- "Received %s message from `%4s' %p\n",
- "WELCOME",
+ LOG(GNUNET_ERROR_TYPE_DEBUG, "Received %s message from `%4s' %p\n", "WELCOME",
GNUNET_i2s (&wm->clientIdentity), client);
GNUNET_STATISTICS_update (plugin->env->stats,
- gettext_noop ("# TCP WELCOME messages received"),
- 1,
- GNUNET_NO);
+ gettext_noop ("# TCP WELCOME messages received"), 1, GNUNET_NO);
session = lookup_session_by_client (plugin, client);
if (NULL != session)
{
@@ -2293,9 +2288,8 @@ handle_tcp_welcome (void *cls,
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Found existing session %p for peer `%s'\n",
- session,
- GNUNET_a2s (vaddr, alen));
- GNUNET_free (vaddr);
+ session, GNUNET_a2s (vaddr, alen));
+ GNUNET_free(vaddr);
}
}
else
@@ -2343,27 +2337,23 @@ handle_tcp_welcome (void *cls,
session->ats_address_network_type = plugin->env->get_address_type (plugin->env->cls, vaddr, alen);
ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
ats.value = htonl (session->ats_address_network_type);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Creating new%s session %p for peer `%s' client %p \n",
- GNUNET_HELLO_address_check_option (session->address,
- GNUNET_HELLO_ADDRESS_INFO_INBOUND)
- ? " inbound" : "",
- session,
- tcp_plugin_address_to_string (NULL,
- (void *) session->address->address,
- session->address->address_length),
- client);
- GNUNET_free (vaddr);
- GNUNET_SERVER_client_set_user_context (session->client, session);
+ LOG(GNUNET_ERROR_TYPE_DEBUG,
+ "Creating new%s session %p for peer `%s' client %p \n",
+ GNUNET_HELLO_address_check_option (session->address,
+ GNUNET_HELLO_ADDRESS_INFO_INBOUND)
+ ? " inbound" : "",
+ session,
+ tcp_plugin_address_to_string(NULL, (void *) session->address->address,
+ session->address->address_length),
+ client);
+ GNUNET_free(vaddr);
+ GNUNET_SERVER_client_set_user_context(session->client, session);
GNUNET_CONTAINER_multipeermap_put (plugin->sessionmap,
&session->target,
session,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
/* Notify transport and ATS about new session */
- plugin->env->session_start (plugin->env->cls,
- session->address,
- session,
- &ats, 1);
+ plugin->env->session_start (NULL, session->address, session, &ats, 1);
notify_session_monitor (plugin,
session,
GNUNET_TRANSPORT_SS_INIT);
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 5b882af26..76c9dfdec 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1327,13 +1327,10 @@ udp_disconnect_session (void *cls,
struct UDP_MessageWrapper *next;
struct FindReceiveContext frc;
- GNUNET_assert (GNUNET_YES != s->in_destroy);
- LOG(GNUNET_ERROR_TYPE_DEBUG,
- "Session %p to peer `%s' address ended\n", s,
+ GNUNET_assert(GNUNET_YES != s->in_destroy);
+ LOG(GNUNET_ERROR_TYPE_DEBUG, "Session %p to peer `%s' address ended\n", s,
GNUNET_i2s (&s->target),
- udp_address_to_string (NULL,
- s->address->address,
- s->address->address_length));
+ udp_address_to_string (NULL, s->address->address, s->address->address_length));
/* stop timeout task */
if (NULL != s->timeout_task)
{
@@ -1408,10 +1405,10 @@ udp_disconnect_session (void *cls,
}
}
- GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
- &s->target,
- s));
+ GNUNET_assert(GNUNET_YES ==
+ GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
+ &s->target,
+ s));
GNUNET_STATISTICS_set (plugin->env->stats,
"# UDP sessions active",
GNUNET_CONTAINER_multipeermap_size (plugin->sessions),
@@ -2338,8 +2335,7 @@ process_udp_message (struct Plugin *plugin,
address = GNUNET_HELLO_address_allocate ( &msg->sender, PLUGIN_NAME,
arg, args,
GNUNET_HELLO_ADDRESS_INFO_INBOUND);
- if ( (NULL == (s = udp_plugin_lookup_session (plugin, address))) &&
- (GNUNET_YES != s->in_destroy) )
+ if (NULL == (s = udp_plugin_lookup_session (plugin, address)))
{
s = udp_plugin_create_session (plugin, address);
plugin->env->session_start (NULL, address, s, NULL, 0);
@@ -2358,12 +2354,9 @@ process_udp_message (struct Plugin *plugin,
si.arg = arg;
si.args = args;
s->rc++;
- GNUNET_SERVER_mst_receive (plugin->mst,
- &si,
- (const char *) &msg[1],
- ntohs (msg->header.size) - sizeof(struct UDPMessage),
- GNUNET_YES,
- GNUNET_NO);
+ GNUNET_SERVER_mst_receive (plugin->mst, &si, (const char *) &msg[1],
+ ntohs (msg->header.size) - sizeof(struct UDPMessage), GNUNET_YES,
+ GNUNET_NO);
s->rc--;
if ((0 == s->rc) && (GNUNET_YES == s->in_destroy))
free_session (s);
@@ -3621,12 +3614,12 @@ libgnunet_plugin_transport_udp_done (void *cls)
return NULL;
}
stop_broadcast (plugin);
- if (plugin->select_task != NULL)
+ if (plugin->select_task != NULL )
{
GNUNET_SCHEDULER_cancel (plugin->select_task);
plugin->select_task = NULL;
}
- if (plugin->select_task_v6 != NULL)
+ if (plugin->select_task_v6 != NULL )
{
GNUNET_SCHEDULER_cancel (plugin->select_task_v6);
plugin->select_task_v6 = NULL;
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 51e8991b9..b0be34346 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -1395,6 +1395,7 @@ process_data (void *cls,
struct Plugin *plugin = cls;
struct GNUNET_HELLO_Address *address;
struct MacAndSession *mas = client;
+ struct MacAndSession xmas;
struct GNUNET_ATS_Information ats;
struct FragmentMessage *fm;
struct GNUNET_PeerIdentity tmpsource;
@@ -1447,17 +1448,6 @@ process_data (void *cls,
&mas->endpoint->wlan_addr,
sizeof (mas->endpoint->wlan_addr),
GNUNET_HELLO_ADDRESS_INFO_INBOUND);
- mas->session = lookup_session (mas->endpoint,
- &tmpsource);
- if (NULL == mas->session)
- {
- mas->session = create_session (mas->endpoint,
- &tmpsource);
- plugin->env->session_start (plugin->env->cls,
- address,
- mas->session,
- &ats, 1);
- }
plugin->env->receive (plugin->env->cls,
address,
mas->session,
@@ -1567,34 +1557,34 @@ process_data (void *cls,
GNUNET_NO);
break;
}
- mas->session = lookup_session (mas->endpoint,
- &wlanheader->sender);
- if (NULL == mas->session)
+ xmas.endpoint = mas->endpoint;
+ if (NULL == (xmas.session = lookup_session (mas->endpoint,
+ &wlanheader->sender)))
{
- mas->session = create_session (mas->endpoint,
+ xmas.session = create_session (mas->endpoint,
&wlanheader->sender);
address = GNUNET_HELLO_address_allocate (&wlanheader->sender,
PLUGIN_NAME,
&mas->endpoint->wlan_addr,
sizeof (struct WlanAddress),
GNUNET_HELLO_ADDRESS_INFO_NONE);
- plugin->env->session_start (plugin->env->cls,
+ plugin->env->session_start (NULL,
address,
- mas->session,
+ xmas.session,
NULL, 0);
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Notifying transport about peer `%s''s new session %p \n",
+ "Notifying transport about peer `%s''s new session %p \n",
GNUNET_i2s (&wlanheader->sender),
- mas->session);
+ xmas.session);
GNUNET_HELLO_address_free (address);
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Processing %u bytes of DATA from peer `%s'\n",
(unsigned int) msize,
GNUNET_i2s (&wlanheader->sender));
- mas->session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
+ xmas.session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
(void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer,
- mas,
+ &xmas,
(const char *) &wlanheader[1],
msize - sizeof (struct WlanHeader),
GNUNET_YES,
@@ -2198,12 +2188,9 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
GNUNET_BANDWIDTH_value_init (100 * 1024 *
1024 / 8),
100);
- plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data,
- plugin);
- plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data,
- plugin);
- plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data,
- plugin);
+ plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);
+ plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);
+ plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin);
plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon,
plugin);
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index 903e6efdc..a727d3e6a 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -87,22 +87,22 @@ static int ok;
/**
* Context of peer 1
*/
-static struct PeerContext *p1;
+struct PeerContext *p1;
/**
* Configuration file of peer 1
*/
-static char *cfg_file_p1;
+char *cfg_file_p1;
/**
* Context of peer 2
*/
-static struct PeerContext *p2;
+struct PeerContext *p2;
/**
* Configuration file of peer 1
*/
-static char *cfg_file_p2;
+char *cfg_file_p2;
/**
* Timeout task
@@ -112,12 +112,12 @@ static struct GNUNET_SCHEDULER_Task * die_task;
/**
* Transport transmit handle used
*/
-static struct GNUNET_TRANSPORT_TransmitHandle *th;
+struct GNUNET_TRANSPORT_TransmitHandle *th;
/**
* Transport testing handle
*/
-static struct GNUNET_TRANSPORT_TESTING_handle *tth;
+struct GNUNET_TRANSPORT_TESTING_handle *tth;
/*
* Total amount of bytes sent
@@ -145,9 +145,7 @@ static int msg_sent;
static int msg_recv;
static int test_connected;
-
static int test_sending;
-
static int test_send_timeout;
@@ -169,11 +167,9 @@ static GNUNET_TRANSPORT_TESTING_ConnectRequest cc;
#define OKPP do { ok++; } while (0)
#endif
-
static int
get_bit (const char *map, unsigned int bit);
-
static void
end ()
{