const struct GNUNET_MessageHeader *imm;
const struct SendOkMessage *okm;
const struct QuotaSetMessage *qm;
+ const struct GNUNET_ATS_Information *ats;
struct GNUNET_TRANSPORT_GetHelloHandle *hwl;
struct GNUNET_TRANSPORT_GetHelloHandle *next_hwl;
struct Neighbour *n;
GNUNET_break (0);
break;
}
+ ats = (const struct GNUNET_ATS_Information *) &cim[1];
#if DEBUG_TRANSPORT_API
LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n",
"CONNECT", GNUNET_i2s (&cim->id));
}
n = neighbour_add (h, &cim->id);
if (h->nc_cb != NULL)
- h->nc_cb (h->cls, &n->id, &cim->ats, ats_count);
+ h->nc_cb (h->cls, &n->id, ats, ats_count);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT:
if (size != sizeof (struct DisconnectInfoMessage))
}
im = (const struct InboundMessage *) msg;
ats_count = ntohl (im->ats_count);
- imm = (const struct GNUNET_MessageHeader *) &((&(im->ats))[ats_count + 1]);
-
+ ats = (const struct GNUNET_ATS_Information *) &im[1];
+ imm = (const struct GNUNET_MessageHeader *) &ats[ats_count];
if (ntohs (imm->size) + sizeof (struct InboundMessage) +
ats_count * sizeof (struct GNUNET_ATS_Information) != size)
{
break;
}
if (h->rec != NULL)
- h->rec (h->cls, &im->peer, imm, &im->ats, ats_count);
+ h->rec (h->cls, &im->peer, imm, ats, ats_count);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA:
#if DEBUG_TRANSPORT_API
qm = (const struct QuotaSetMessage *) msg;
n = neighbour_find (h, &qm->peer);
if (n == NULL)
- {
- GNUNET_break (0);
break;
- }
GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, qm->quota);
break;
default:
{
struct GNUNET_TRANSPORT_Handle *h = cls;
struct StartMessage s;
+ uint32_t options;
if (buf == NULL)
{
GNUNET_assert (size >= sizeof (struct StartMessage));
s.header.size = htons (sizeof (struct StartMessage));
s.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_START);
- s.do_check = htonl (h->check_self);
+ options = 0;
+ if (h->check_self)
+ options |= 1;
+ if (h->rec != NULL)
+ options |= 2;
+ s.options = htonl (options);
s.self = h->self;
memcpy (buf, &s, sizeof (struct StartMessage));
GNUNET_CLIENT_receive (h->client, &demultiplexer, h,
struct GNUNET_TRANSPORT_TransmitHandle *th;
GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK);
- /* Forget about all neighbours that we used to be connected to */
- GNUNET_CONTAINER_multihashmap_iterate (h->neighbours, &neighbour_delete, h);
if (NULL != h->cth)
{
GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth);
GNUNET_CLIENT_disconnect (h->client, GNUNET_YES);
h->client = NULL;
}
+ /* Forget about all neighbours that we used to be connected to */
+ GNUNET_CONTAINER_multihashmap_iterate (h->neighbours, &neighbour_delete, h);
if (h->quota_task != GNUNET_SCHEDULER_NO_TASK)
{
GNUNET_SCHEDULER_cancel (h->quota_task);