aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-24 13:25:56 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-24 13:26:38 +0100
commit0f67fd7bc65b07feceff790fb18e7e8a0aaeac69 (patch)
tree50ef7b55ac0cc03b6bfc8dac5978328db2729db1 /src
parente86eed18860a354d1b224503a8f51c06c615e79d (diff)
downloadgnunet-0f67fd7bc65b07feceff790fb18e7e8a0aaeac69.tar.gz
gnunet-0f67fd7bc65b07feceff790fb18e7e8a0aaeac69.zip
update counters properly
Diffstat (limited to 'src')
-rw-r--r--src/cadet/gnunet-service-cadet-new_tunnels.c7
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c17
2 files changed, 16 insertions, 8 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c
index af77ea067..05a1e071d 100644
--- a/src/cadet/gnunet-service-cadet-new_tunnels.c
+++ b/src/cadet/gnunet-service-cadet-new_tunnels.c
@@ -603,6 +603,7 @@ GCT_count_any_connections (const struct CadetTunnel *t)
603static struct CadetTConnection * 603static struct CadetTConnection *
604get_ready_connection (struct CadetTunnel *t) 604get_ready_connection (struct CadetTunnel *t)
605{ 605{
606 GNUNET_assert (GNUNET_YES == t->connection_ready_head->is_ready);
606 return t->connection_ready_head; 607 return t->connection_ready_head;
607} 608}
608 609
@@ -1971,13 +1972,19 @@ GCT_connection_lost (struct CadetTConnection *ct)
1971 struct CadetTunnel *t = ct->t; 1972 struct CadetTunnel *t = ct->t;
1972 1973
1973 if (GNUNET_YES == ct->is_ready) 1974 if (GNUNET_YES == ct->is_ready)
1975 {
1974 GNUNET_CONTAINER_DLL_remove (t->connection_ready_head, 1976 GNUNET_CONTAINER_DLL_remove (t->connection_ready_head,
1975 t->connection_ready_tail, 1977 t->connection_ready_tail,
1976 ct); 1978 ct);
1979 t->num_ready_connections--;
1980 }
1977 else 1981 else
1982 {
1978 GNUNET_CONTAINER_DLL_remove (t->connection_busy_head, 1983 GNUNET_CONTAINER_DLL_remove (t->connection_busy_head,
1979 t->connection_busy_tail, 1984 t->connection_busy_tail,
1980 ct); 1985 ct);
1986 t->num_busy_connections--;
1987 }
1981 GNUNET_free (ct); 1988 GNUNET_free (ct);
1982} 1989}
1983 1990
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 3952a728e..bbda715a2 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1150,17 +1150,18 @@ set_incoming_quota (struct NeighbourMapEntry *n,
1150 sqm.header.size = htons (sizeof (struct GNUNET_ATS_SessionQuotaMessage)); 1150 sqm.header.size = htons (sizeof (struct GNUNET_ATS_SessionQuotaMessage));
1151 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA); 1151 sqm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA);
1152 sqm.quota = quota.value__; 1152 sqm.quota = quota.value__;
1153 (void) send_with_session (n, 1153 if (NULL != n->primary_address.session)
1154 &sqm, 1154 (void) send_with_session (n,
1155 sizeof (sqm), 1155 &sqm,
1156 UINT32_MAX - 1, 1156 sizeof (sqm),
1157 GNUNET_TIME_UNIT_FOREVER_REL, 1157 UINT32_MAX - 1,
1158 GNUNET_NO, 1158 GNUNET_TIME_UNIT_FOREVER_REL,
1159 NULL, NULL); 1159 GNUNET_NO,
1160 NULL, NULL);
1160 return; 1161 return;
1161 } 1162 }
1162 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1163 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1163 "Disconnecting peer `%4s' due to SET_QUOTA\n", 1164 "Disconnecting peer `%s' due to SET_QUOTA\n",
1164 GNUNET_i2s (&n->id)); 1165 GNUNET_i2s (&n->id));
1165 if (GNUNET_YES == test_connected (n)) 1166 if (GNUNET_YES == test_connected (n))
1166 GNUNET_STATISTICS_update (GST_stats, 1167 GNUNET_STATISTICS_update (GST_stats,