Previous: , Up: Interacting directly with other Peers using the CORE Service   [Contents]


4.5.4 End of P2P connections

If a message handler returns GNUNET\_SYSERR, the remote peer shuts down or there is an unrecoverable network disconnection, CORE notifies the service that the peer disconnected. After this notification no more messages will be received from the peer and the service is no longer allowed to send messages to the peer. The disconnect callback looks like the following:

void
disconnects (void *cls,
             const struct GNUNET_PeerIdentity * peer)
{
    /* Remove peer's identity from known peers */
    /* Make sure no messages are sent to peer from now on */
}

Exercise: Fix your service to handle peer disconnects.