aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-22 20:22:59 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-22 20:22:59 +0000
commit9ffd65f2427a9f553eb5390800c3a6191d0bfb8a (patch)
treea3a90579b5bb24a0f863a15837358e98dbca19a1 /src
parent3a81c3e236a3679c0c0676d814c71d9ae5f38ec3 (diff)
downloadgnunet-9ffd65f2427a9f553eb5390800c3a6191d0bfb8a.tar.gz
gnunet-9ffd65f2427a9f553eb5390800c3a6191d0bfb8a.zip
fixing 1836
Diffstat (limited to 'src')
-rw-r--r--src/transport/gnunet-service-transport.c22
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c9
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h4
3 files changed, 25 insertions, 10 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 602a597e5..bbbb6f78b 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -412,20 +412,30 @@ ats_request_address_change (void *cls, const struct GNUNET_PeerIdentity *peer,
412 GST_neighbours_force_disconnect(peer); 412 GST_neighbours_force_disconnect(peer);
413 return; 413 return;
414 } 414 }
415 415 if (GNUNET_YES !=
416 GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr, 416 GST_neighbours_switch_to_address (peer, plugin_name, plugin_addr,
417 plugin_addr_len, session, ats, ats_count); 417 plugin_addr_len, session, ats, ats_count))
418 {
419#if DEBUG_TRANSPORT
420 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
421 "Connection is not yet up, ignoring quota for now\n");
422#endif
423 /* FIXME: maybe we should let ATS know somehow? This is a problem
424 with the design; ATS may assign bandwidth, but we don't use it;
425 the current ATS API doesn't give us a good way to sync the
426 connection status between ATS and TRANSPORT */
427 return;
428 }
418#if DEBUG_TRANSPORT 429#if DEBUG_TRANSPORT
419 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 430 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
420 "Sending outbound quota of %u Bps for peer `%s' to all clients\n", 431 "Sending outbound quota of %u Bps for peer `%s' to all clients\n",
421 ntohl (bandwidth_out.value__), GNUNET_i2s (peer)); 432 ntohl (bandwidth_out.value__), GNUNET_i2s (peer));
422#endif 433#endif
423 msg.header.size = htons (sizeof (struct QuotaSetMessage)); 434 msg.header.size = htons (sizeof (struct QuotaSetMessage));
424 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); 435 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA);
425 msg.quota = bandwidth_out; 436 msg.quota = bandwidth_out;
426 msg.peer = (*peer); 437 msg.peer = (*peer);
427 GST_clients_broadcast (&msg.header, GNUNET_NO); 438 GST_clients_broadcast (&msg.header, GNUNET_NO);
428
429#if DEBUG_TRANSPORT 439#if DEBUG_TRANSPORT
430 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 440 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
431 "Setting inbound quota of %u for peer `%s' to \n", 441 "Setting inbound quota of %u for peer `%s' to \n",
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 486be2314..55a943e55 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -666,8 +666,10 @@ send_connect_continuation (void *cls,
666 * @param session session to use (or NULL) 666 * @param session session to use (or NULL)
667 * @param ats performance data 667 * @param ats performance data
668 * @param ats_count number of entries in ats (excluding 0-termination) 668 * @param ats_count number of entries in ats (excluding 0-termination)
669 * @return GNUNET_YES if we are currently connected, GNUNET_NO if the
670 * connection is not up (yet)
669 */ 671 */
670void 672int
671GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, 673GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
672 const char *plugin_name, const void *address, 674 const char *plugin_name, const void *address,
673 size_t address_len, struct Session *session, 675 size_t address_len, struct Session *session,
@@ -687,7 +689,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
687 peer, 689 peer,
688 plugin_name, address, 690 plugin_name, address,
689 address_len, NULL); 691 address_len, NULL);
690 return; 692 return GNUNET_NO;
691 } 693 }
692 was_connected = n->is_connected; 694 was_connected = n->is_connected;
693 n->is_connected = GNUNET_YES; 695 n->is_connected = GNUNET_YES;
@@ -727,12 +729,13 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
727 &send_connect_continuation, 729 &send_connect_continuation,
728 n); 730 n);
729 if (GNUNET_YES == was_connected) 731 if (GNUNET_YES == was_connected)
730 return; 732 return GNUNET_YES;
731 /* First tell clients about connected neighbours...*/ 733 /* First tell clients about connected neighbours...*/
732 neighbours_connected++; 734 neighbours_connected++;
733 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1, 735 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
734 GNUNET_NO); 736 GNUNET_NO);
735 connect_notify_cb (callback_cls, peer, ats, ats_count); 737 connect_notify_cb (callback_cls, peer, ats, ats_count);
738 return GNUNET_YES;
736} 739}
737 740
738 741
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h
index 27f7aae31..09384bafd 100644
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ b/src/transport/gnunet-service-transport_neighbours.h
@@ -200,8 +200,10 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
200 * @param session session to use (or NULL) 200 * @param session session to use (or NULL)
201 * @param ats performance data 201 * @param ats performance data
202 * @param ats_count number of entries in ats (excluding 0-termination) 202 * @param ats_count number of entries in ats (excluding 0-termination)
203 * @return GNUNET_YES if we are currently connected, GNUNET_NO if the
204 * connection is not up (yet)
203 */ 205 */
204void 206int
205GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer, 207GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
206 const char *plugin_name, const void *address, 208 const char *plugin_name, const void *address,
207 size_t address_len, struct Session *session, 209 size_t address_len, struct Session *session,