know about this one, so we need to
notify transport service about disconnect */
session->plugin->env->receive (session->plugin->env->cls,
- 1,
+ NULL,
+ &session->target,
+ 1,
session->connect_addr,
- session->connect_alen,
- &session->target, NULL);
+ session->connect_alen);
}
if (session->client != NULL)
{
(unsigned int) msize,
(unsigned int) ntohs (msg->type));
#endif
- plugin->env->receive (plugin->env->cls, 1,
+ plugin->env->receive (plugin->env->cls, message, &session->target, 1,
session->connect_addr,
- session->connect_alen,
- &session->target, message);
+ session->connect_alen);
/* update bandwidth used */
session->last_received += msize;
update_quota (session, GNUNET_NO);
/**
* Callback to call once we got our HELLO.
*/
- GNUNET_TRANSPORT_ReceiveCallback rec;
+ GNUNET_TRANSPORT_HelloUpdateCallback rec;
/**
* Closure for rec.
else
prev->next = hwl->next;
if (hwl->rec != NULL)
- hwl->rec (hwl->rec_cls, GNUNET_TIME_UNIT_ZERO, NULL, NULL);
+ hwl->rec (hwl->rec_cls, NULL);
GNUNET_free (hwl);
}
*/
void
GNUNET_TRANSPORT_get_hello (struct GNUNET_TRANSPORT_Handle *handle,
- struct GNUNET_TIME_Relative timeout,
- GNUNET_TRANSPORT_ReceiveCallback rec,
+ GNUNET_TRANSPORT_HelloUpdateCallback rec,
void *rec_cls)
{
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pk;
hwl->handle = handle;
hwl->rec = rec;
hwl->rec_cls = rec_cls;
- hwl->timeout = GNUNET_TIME_relative_to_absolute (timeout);
+ /* hwl->timeout = GNUNET_TIME_relative_to_absolute (timeout);
+ * Timeout not needed, because we should notify on change.
+ * FIXME: set up scheduler to notify on modification?
+
hwl->task = GNUNET_SCHEDULER_add_delayed (handle->sched,
timeout,
&hello_wait_timeout, hwl);
+ */
return;
}
GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_key (handle->my_hello, &pk));
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
&me.hashPubKey);
- rec (rec_cls,
- GNUNET_TIME_UNIT_ZERO,
- &me, (const struct GNUNET_MessageHeader *) handle->my_hello);
+ rec (rec_cls, (const struct GNUNET_MessageHeader *) handle->my_hello);
}
add_neighbour (struct GNUNET_TRANSPORT_Handle *h,
uint32_t quota_out,
struct GNUNET_TIME_Relative latency,
+ uint16_t distance,
const struct GNUNET_PeerIdentity *pid)
{
struct NeighbourList *n;
n->transmit_ok = GNUNET_YES;
h->neighbours = n;
if (h->nc_cb != NULL)
- h->nc_cb (h->cls, &n->id, latency);
+ h->nc_cb (h->cls, &n->id, latency, distance);
prev = NULL;
pos = h->connect_wait_head;
while (pos != NULL)
("Disconnect while trying to obtain `%s' from transport service.\n"),
"HELLO");
if (hwl->rec != NULL)
- hwl->rec (hwl->rec_cls, GNUNET_TIME_UNIT_ZERO, NULL, NULL);
+ hwl->rec (hwl->rec_cls, NULL);
GNUNET_free (hwl);
}
if (handle->reconnect_task != GNUNET_SCHEDULER_NO_TASK)
h->hwl_head = hwl->next;
GNUNET_SCHEDULER_cancel (h->sched, hwl->task);
GNUNET_TRANSPORT_get_hello (h,
- GNUNET_TIME_UNIT_ZERO,
hwl->rec, hwl->rec_cls);
GNUNET_free (hwl);
}
#endif
add_neighbour (h,
ntohl (cim->quota_out),
- GNUNET_TIME_relative_ntoh (cim->latency), &cim->id);
+ GNUNET_TIME_relative_ntoh (cim->latency), ntohs(cim->distance), &cim->id);
break;
case GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT:
if (size != sizeof (struct DisconnectInfoMessage))
ntohs (imm->type), GNUNET_i2s (&im->peer));
#endif
if (h->rec != NULL)
- h->rec (h->cls,
- GNUNET_TIME_relative_ntoh (im->latency), &im->peer, imm);
+ h->rec (h->cls, &im->peer, imm,
+ GNUNET_TIME_relative_ntoh (im->latency), ntohs(im->distance));
break;
}
break;