/**
* Connection create message sent, waiting for ACK.
*/
- CADET_CHANNEL_CREATE_SENT,
+ CADET_CHANNEL_OPEN_SENT,
/**
* Connection confirmed, ready to carry traffic.
msgcc.opt = htonl (options);
msgcc.port = ch->port;
msgcc.ctn = ch->ctn;
- ch->state = CADET_CHANNEL_CREATE_SENT;
+ ch->state = CADET_CHANNEL_OPEN_SENT;
ch->last_control_qe = GCT_send (ch->t,
&msgcc.header,
&channel_open_sent_cb,
/* this should be impossible */
GNUNET_break (0);
break;
- case CADET_CHANNEL_CREATE_SENT:
+ case CADET_CHANNEL_OPEN_SENT:
if (NULL == ch->owner)
{
/* We're not the owner, wrong direction! */
GCP_request_mq_cancel (cc->mq_man,
env);
cc->mq_man = NULL;
+ if (NULL != cc->task)
+ {
+ GNUNET_SCHEDULER_cancel (cc->task);
+ cc->task = NULL;
+ }
GCPP_del_connection (cc->path,
cc->off,
cc);
struct GNUNET_MQ_Envelope *env;
cc->task = NULL;
+ GNUNET_assert (CADET_CONNECTION_CREATE_RECEIVED == cc->state);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending CONNECTION_CREATE_ACK message for %s\n",
GCC_2s (cc));
if (GNUNET_YES == cc->mqm_ready)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Got duplicate CREATE for %s, scheduling another ACK\n",
- GCC_2s (cc));
+ "Got duplicate CREATE for %s, scheduling another ACK (%s)\n",
+ GCC_2s (cc),
+ (GNUNET_YES == cc->mqm_ready) ? "MQM ready" : "MQM busy");
/* Tell tunnel that we are not ready for transmission anymore
(until CREATE_ACK is done) */
cc->ready_cb (cc->ready_cb_cls,
/* Revert back to the state of having only received the 'CREATE',
and immediately proceed to send the CREATE_ACK. */
cc->state = CADET_CONNECTION_CREATE_RECEIVED;
+ if (NULL != cc->task)
+ GNUNET_SCHEDULER_cancel (cc->task);
cc->task = GNUNET_SCHEDULER_add_now (&send_create_ack,
cc);
}
/* Shrink path to actual useful length */
GNUNET_array_grow (path->entries,
path->entries_length,
- i);
+ i + 1);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Created new path %s based on information from DHT\n",
GCPP_2s (path));
struct CadetPeerPathEntry *entry,
unsigned int off)
{
+ GNUNET_assert (cp == GCPP_get_peer_at_offset (entry->path,
+ off));
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Discovered that peer %s is on path %s at offset %u\n",
GCP_2s (cp),
GNUNET_CONTAINER_HeapCostType root_desirability;
struct GNUNET_CONTAINER_HeapNode *hn;
+ GNUNET_assert (cp == GCPP_get_peer_at_offset (path,
+ off));
if (NULL == cp->path_heap)
{
/* #GCP_drop_owned_paths() was already called, we cannot take new ones! */
&msg->ephemeral_key);
GNUNET_CRYPTO_ecdhe_key_get_public (ax->DHRs,
&msg->ratchet_key);
+ ct->is_ready = GNUNET_NO;
GCC_transmit (cc,
env);
t->kx_retry_delay = GNUNET_TIME_STD_BACKOFF (t->kx_retry_delay);
GNUNET_free (ct);
}
while (NULL != (tq = t->tq_head))
+ {
+ if (NULL != tq->cont)
+ tq->cont (tq->cont_cls);
GCT_send_cancel (tq);
+ }
GCP_drop_tunnel (t->destination,
t);
GNUNET_CONTAINER_multihashmap32_destroy (t->channels);
struct CadetTunnel *
GCT_create_tunnel (struct CadetPeer *destination)
{
+ struct CadetTunnel *t = GNUNET_new (struct CadetTunnel);
struct GNUNET_MQ_MessageHandler handlers[] = {
GNUNET_MQ_hd_fixed_size (plaintext_keepalive,
GNUNET_MESSAGE_TYPE_CADET_CHANNEL_KEEPALIVE,
struct GNUNET_MessageHeader,
- NULL),
+ t),
GNUNET_MQ_hd_var_size (plaintext_data,
GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA,
struct GNUNET_CADET_ChannelAppDataMessage,
- NULL),
+ t),
GNUNET_MQ_hd_fixed_size (plaintext_data_ack,
GNUNET_MESSAGE_TYPE_CADET_CHANNEL_APP_DATA_ACK,
struct GNUNET_CADET_ChannelDataAckMessage,
- NULL),
+ t),
GNUNET_MQ_hd_fixed_size (plaintext_channel_open,
GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN,
struct GNUNET_CADET_ChannelOpenMessage,
- NULL),
+ t),
GNUNET_MQ_hd_fixed_size (plaintext_channel_open_ack,
GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK,
struct GNUNET_CADET_ChannelManageMessage,
- NULL),
+ t),
GNUNET_MQ_hd_fixed_size (plaintext_channel_destroy,
GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY,
struct GNUNET_CADET_ChannelManageMessage,
- NULL),
+ t),
GNUNET_MQ_handler_end ()
};
- struct CadetTunnel *t;
- t = GNUNET_new (struct CadetTunnel);
new_ephemeral (t);
t->ax.kx_0 = GNUNET_CRYPTO_ecdhe_key_create ();
t->destination = destination;