return GNUNET_YES;
}
+static int reconnecting;
/**
* Function we use for handling incoming messages.
uint32_t bytes_physical;
GNUNET_assert (NULL != h->client);
+ if (GNUNET_YES == reconnecting)
+ {
+ return;
+ }
if (NULL == msg)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Error receiving from transport service, disconnecting temporarily.\n");
+ reconnecting = GNUNET_YES;
disconnect_and_schedule_reconnect (h);
return;
}
okm = (const struct SendOkMessage *) msg;
bytes_msg = ntohl (okm->bytes_msg);
bytes_physical = ntohl (okm->bytes_physical);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message, transmission %s.\n",
- "SEND_OK", ntohl (okm->success) == GNUNET_OK ? "succeeded" : "failed");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Receiving SEND_OK message, transmission %s.\n",
+ ntohl (okm->success) == GNUNET_OK ? "succeeded" : "failed");
n = neighbour_find (h, &okm->peer);
if (NULL == n)
if (bytes_physical >= bytes_msg)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Overhead for %u byte message: %u \n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Overhead for %u byte message: %u\n",
bytes_msg, bytes_physical - bytes_msg);
n->traffic_overhead += bytes_physical - bytes_msg;
}
GNUNET_assert (NULL == h->client);
GNUNET_assert (NULL == h->control_head);
GNUNET_assert (NULL == h->control_tail);
+ reconnecting = GNUNET_NO;
h->client = GNUNET_CLIENT_connect ("transport", h->cfg);
+
GNUNET_assert (NULL != h->client);
schedule_control_transmit (h, sizeof (struct StartMessage), &send_start, h);
}
{
GNUNET_CLIENT_disconnect (h->client);
h->client = NULL;
+/* LOG (GNUNET_ERROR_TYPE_ERROR,
+ "Client disconnect done \n");*/
}
/* Forget about all neighbours that we used to be connected to */
GNUNET_CONTAINER_multipeermap_iterate (h->neighbours,
/**
* Disconnect from the transport service.
*
- * @param handle handle to the service as returned from GNUNET_TRANSPORT_connect
+ * @param handle handle to the service as returned from #GNUNET_TRANSPORT_connect()
*/
void
GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle)