summaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-02-26 02:03:37 +0100
committerChristian Grothoff <christian@grothoff.org>2017-02-26 02:03:37 +0100
commite332f0f541283f8d28535af9330d279e82281da4 (patch)
treeed90fa9a63199893cf9c248eee4ccce09a625526 /src/transport/gnunet-service-transport_neighbours.c
parent723fb14835687ffa98e76a4534b8fd7ca86c886e (diff)
#4801 seems solidly fixed now, don't see how it can happen anymore
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index bbda715a2..19f5fd081 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -2136,13 +2136,18 @@ setup_neighbour (const struct GNUNET_PeerIdentity *peer)
{
struct NeighbourMapEntry *n;
+ if (0 ==
+ memcmp (&GST_my_identity,
+ peer,
+ sizeof (struct GNUNET_PeerIdentity)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Cowardly refusing to consider myself my neighbour!\n");
+ return NULL;
+ }
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Creating new neighbour entry for `%s'\n",
GNUNET_i2s (peer));
- GNUNET_assert (0 !=
- memcmp (&GST_my_identity,
- peer,
- sizeof (struct GNUNET_PeerIdentity)));
n = GNUNET_new (struct NeighbourMapEntry);
n->id = *peer;
n->ack_state = ACK_UNDEFINED;
@@ -2250,6 +2255,7 @@ GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message,
{
/* This is a new neighbour and set to not connected */
n = setup_neighbour (peer);
+ GNUNET_assert (NULL != n);
}
/* Remember this SYN message in neighbour */
@@ -2319,6 +2325,7 @@ GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message,
/* Get rid of remains and re-try */
free_neighbour (n);
n = setup_neighbour (peer);
+ GNUNET_assert (NULL != n);
/* Remember the SYN time stamp for ACK message */
n->ack_state = ACK_SEND_SYN_ACK;
n->connect_ack_timestamp = ts;
@@ -2496,6 +2503,12 @@ switch_address_bl_check_cont (void *cls,
if (NULL == (n = lookup_neighbour (peer)))
{
n = setup_neighbour (peer);
+ if (NULL == n)
+ {
+ /* not sure how this can happen... */
+ GNUNET_break (0);
+ goto cleanup;
+ }
n->state = GNUNET_TRANSPORT_PS_INIT_ATS;
}