[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19427 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19427 - gnunet/src/transport |
Date: |
Thu, 26 Jan 2012 13:21:37 +0100 |
Author: wachs
Date: 2012-01-26 13:21:37 +0100 (Thu, 26 Jan 2012)
New Revision: 19427
Modified:
gnunet/src/transport/gnunet-service-transport_neighbours.c
gnunet/src/transport/plugin_transport_http.c
gnunet/src/transport/plugin_transport_tcp.c
Log:
- more new code
Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c 2012-01-26
11:30:42 UTC (rev 19426)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c 2012-01-26
12:21:37 UTC (rev 19427)
@@ -1363,7 +1363,8 @@
int
GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Address
- *address, struct Session *session,
+ *address,
+ struct Session *session,
const struct GNUNET_ATS_Information
*ats,
uint32_t ats_count,
struct GNUNET_BANDWIDTH_Value32NBO
@@ -1442,13 +1443,58 @@
GNUNET_HELLO_address_free (n->address);
n->address = GNUNET_HELLO_address_copy (address);
n->address_state = FRESH;
- n->session = session;
n->bandwidth_in = bandwidth_in;
n->bandwidth_out = bandwidth_out;
GNUNET_SCHEDULER_cancel (n->timeout_task);
n->timeout_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
&neighbour_timeout_task, n);
+
+#if TEST_NEW_CODE
+ /* Obtain an session for this address from plugin */
+ papi = GST_plugins_find (address->transport_name);
+ GNUNET_assert (papi != NULL);
+ if (session == NULL)
+ {
+ struct GNUNET_TRANSPORT_PluginFunctions *papi;
+ n->session = papi->get_session (papi->cls, address);
+ /* Session could not be initiated */
+ if (n->session == NULL)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to obtain new session %p for peer `%s' and address
'%s'\n",
+ n->session, GNUNET_i2s (&n->id), GST_plugins_a2s
(n->address));
+
+ GNUNET_ATS_address_destroyed (GST_ats, n->address, NULL);
+
+ if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK)
+ GNUNET_SCHEDULER_cancel (n->ats_suggest);
+ n->ats_suggest = GNUNET_SCHEDULER_add_delayed (ATS_RESPONSE_TIMEOUT,
+ ats_suggest_cancel,
+ n);
+ GNUNET_ATS_suggest_address (GST_ats, &n->id);
+ GNUNET_HELLO_address_free (n->address);
+ n->address = NULL;
+ return GNUNET_NO;
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Obtained new session %p for peer `%s' and address '%s'\n",
+ n->session, GNUNET_i2s (&n->id), GST_plugins_a2s
(n->address));
+ }
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Using existing session %p for peer `%s' and address '%s'\n",
+ n->session, GNUNET_i2s (&n->id), GST_plugins_a2s (n->address));
+ n->session = session;
+ }
+#else
+ n->session = session;
+#endif
+
switch (n->state)
{
case S_NOT_CONNECTED:
Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c 2012-01-26 11:30:42 UTC
(rev 19426)
+++ gnunet/src/transport/plugin_transport_http.c 2012-01-26 12:21:37 UTC
(rev 19427)
@@ -540,7 +540,7 @@
* @return the session or NULL of max connections exceeded
*/
-static const struct Session *
+static struct Session *
http_get_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2012-01-26 11:30:42 UTC (rev
19426)
+++ gnunet/src/transport/plugin_transport_tcp.c 2012-01-26 12:21:37 UTC (rev
19427)
@@ -1305,7 +1305,8 @@
* @param addrlen length of addr
* @return the session if the address is valid, NULL otherwise
*/
-const const struct Session * tcp_plugin_create_session (void *cls,
+static struct Session *
+tcp_plugin_create_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
struct Plugin * plugin = cls;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19427 - gnunet/src/transport,
gnunet <=