"Iteration destroying peers was aborted.\n");
}
GNUNET_CONTAINER_multipeermap_destroy (peer_map);
+ peer_map = NULL;
store_valid_peers ();
GNUNET_free (filename_valid_peers);
GNUNET_CONTAINER_multipeermap_destroy (valid_peers);
int
Peers_check_peer_known (const struct GNUNET_PeerIdentity *peer)
{
- return GNUNET_CONTAINER_multipeermap_contains (peer_map, peer);
+ if (NULL != peer_map)
+ {
+ return GNUNET_CONTAINER_multipeermap_contains (peer_map, peer);
+ } else
+ {
+ return GNUNET_NO;
+ }
}
const struct GNUNET_PeerIdentity *initiator)
{
struct PeerContext *peer_ctx;
+ struct GNUNET_PeerIdentity *ctx_peer;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"New channel was established to us (Peer %s).\n",
/* Make sure we 'know' about this peer */
peer_ctx = create_or_get_peer_ctx (initiator);
set_peer_live (peer_ctx);
+ ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity);
+ *ctx_peer = *initiator;
/* We only accept one incoming channel per peer */
if (GNUNET_YES == Peers_check_peer_send_intention (initiator))
{
GNUNET_CADET_channel_destroy (peer_ctx->recv_channel);
peer_ctx->recv_channel = channel;
/* return the channel context */
- return &peer_ctx->peer_id;
+ return ctx_peer;
}
peer_ctx->recv_channel = channel;
- return &peer_ctx->peer_id;
+ return ctx_peer;
}
set_channel_flag (peer_ctx->send_channel_flags, Peers_CHANNEL_CLEAN);
GNUNET_CADET_channel_destroy (peer_ctx->send_channel);
peer_ctx->send_channel = NULL;
+ peer_ctx->mq = NULL;
(void) Peers_check_connected (peer);
return GNUNET_YES;
}
to_file (file_name_view_log,
"-%s\t(cleanup channel, ourself)",
GNUNET_i2s_full (peer));
+ //GNUNET_free (peer);
return;
}
{ /* We are about to clean the sending channel. Clean the respective
* context */
Peers_cleanup_destroyed_channel (cls, channel);
+ //GNUNET_free (peer);
return;
}
else
* open. It probably went down. Remove it from our knowledge. */
Peers_cleanup_destroyed_channel (cls, channel);
remove_peer (peer);
+ //GNUNET_free (peer);
return;
}
}
{ /* Other peer tried to establish a channel to us twice. We do not accept
* that. Clean the context. */
Peers_cleanup_destroyed_channel (cls, channel);
+ //GNUNET_free (peer);
return;
}
else
* it. */
Peers_cleanup_destroyed_channel (cls, channel);
clean_peer (peer);
+ //GNUNET_free (peer);
return;
}
}
LOG (GNUNET_ERROR_TYPE_WARNING,
"Destroyed channel is neither sending nor receiving channel\n");
}
+ //GNUNET_free (peer);
}
/***********************************************************************
*index = CustomPeerMap_size (c_peer_map);
p = GNUNET_new (struct GNUNET_PeerIdentity);
*p = *peer;
- GNUNET_CONTAINER_multipeermap_put (c_peer_map->peer_map, peer, index,
+ GNUNET_assert (p != peer);
+ GNUNET_assert (0 == memcmp (p, peer, sizeof(struct GNUNET_PeerIdentity)));
+ GNUNET_CONTAINER_multipeermap_put (c_peer_map->peer_map, p, index,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map, *index, p,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
*last_index = *index;
}
GNUNET_free (index);
- GNUNET_free (p);
GNUNET_assert (GNUNET_CONTAINER_multihashmap32_size (c_peer_map->hash_map) ==
GNUNET_CONTAINER_multipeermap_size (c_peer_map->peer_map));
return GNUNET_OK;