diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport_ats.c | 26 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_ats.h | 14 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 9 |
3 files changed, 41 insertions, 8 deletions
diff --git a/src/transport/gnunet-service-transport_ats.c b/src/transport/gnunet-service-transport_ats.c index d204a8950..5301090ff 100644 --- a/src/transport/gnunet-service-transport_ats.c +++ b/src/transport/gnunet-service-transport_ats.c @@ -345,6 +345,32 @@ GST_ats_block_address (const struct GNUNET_HELLO_Address *address, /** + * Reset address blocking time. Resets the exponential + * back-off timer for this address to zero. Done when + * an address was used to create a successful connection. + * + * @param address the address to reset the blocking timer + * @param session the session (can be NULL) + */ +void +GST_ats_block_reset (const struct GNUNET_HELLO_Address *address, + struct Session *session) +{ + struct AddressInfo *ai; + + ai = find_ai (address, session); + if (NULL == ai) + { + GNUNET_break (0); + return; + } + /* address is in successful use, so it should not be blocked right now */ + GNUNET_break (NULL == ai->unblock_task); + ai->back_off = GNUNET_TIME_UNIT_ZERO; +} + + +/** * Notify ATS about the a new inbound address. We may already * know the address (as this is called each time we receive * a message from an inbound connection). If the address is diff --git a/src/transport/gnunet-service-transport_ats.h b/src/transport/gnunet-service-transport_ats.h index 780e66f60..bee38d0cd 100644 --- a/src/transport/gnunet-service-transport_ats.h +++ b/src/transport/gnunet-service-transport_ats.h @@ -67,8 +67,18 @@ GST_ats_block_address (const struct GNUNET_HELLO_Address *address, struct Session *session); -/* FIXME: might want to add a function to reset the - back-off from blocking */ +/** + * Reset address blocking time. Resets the exponential + * back-off timer for this address to zero. Done when + * an address was used to create a successful connection. + * + * @param address the address to reset the blocking timer + * @param session the session (can be NULL) + */ +void +GST_ats_block_reset (const struct GNUNET_HELLO_Address *address, + struct Session *session); + /** * Notify ATS about the a new inbound address. We may already diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 623712efa..729de12d3 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -3467,12 +3467,9 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, GNUNET_TRANSPORT_PS_CONNECTED, GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT)); - /* Set primary address to used */ - set_primary_address (n, - n->primary_address.address, - n->primary_address.session, - n->primary_address.bandwidth_in, - n->primary_address.bandwidth_out); + /* Reset backoff for primary address */ + GST_ats_block_reset (n->primary_address.address, + n->primary_address.session); return GNUNET_OK; } |