GNUNET_break (0);
return;
}
+
if (i < p->length - 1)
t->next_hop = p->peers[i + 1];
else
t->prev_hop = p->peers[i - 1];
else
t->prev_hop = 0;
+
if (NULL != t->path)
path_destroy (t->path);
t->path = path_duplicate (p);
+ if (GNUNET_SCHEDULER_NO_TASK == t->path_refresh_task)
+ t->path_refresh_task =
+ GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t);
}
}
-/**
- * Fill the core buffer
- *
- * @param cls closure (data itself)
- * @param size number of bytes available in buf
- * @param buf where the callee should write the message
- *
- * @return number of bytes written to buf
- */
-static size_t
-send_core_data_multicast (void *cls, size_t size, void *buf)
-{
- struct MeshTransmissionDescriptor *info = cls;
- size_t total_size;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Multicast callback.\n");
- GNUNET_assert (NULL != info);
- GNUNET_assert (NULL != info->peer);
- total_size = info->data_len;
- GNUNET_assert (total_size < GNUNET_SERVER_MAX_MESSAGE_SIZE);
-
- if (total_size > size)
- {
- GNUNET_break (0);
- return 0;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " copying data...\n");
- memcpy (buf, info->data, total_size);
-#if MESH_DEBUG
- {
- struct GNUNET_MessageHeader *mh;
-
- mh = buf;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " type %s\n",
- GNUNET_MESH_DEBUG_M2S (ntohs (mh->type)));
- }
-#endif
- GNUNET_free (info->data);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "freeing info...\n");
- GNUNET_free (info);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "return %u\n", total_size);
- return total_size;
-}
-
-
/**
* Creates a path ack message in buf and frees all unused resources.
*
case GNUNET_MESSAGE_TYPE_MESH_PATH_BROKEN:
case GNUNET_MESSAGE_TYPE_MESH_PATH_DESTROY:
case GNUNET_MESSAGE_TYPE_MESH_TUNNEL_DESTROY:
+ case GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"********* raw: %s\n",
GNUNET_MESH_DEBUG_M2S (queue->type));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* path ack\n");
data_size = send_core_path_ack (queue->cls, size, buf);
break;
- case GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* path keepalive\n");
- data_size = send_core_data_multicast (queue->cls, size, buf);
- break;
default:
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
path_refresh (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct MeshTunnel *t = cls;
+ struct GNUNET_PeerIdentity id;
struct GNUNET_MESH_TunnelKeepAlive *msg;
size_t size = sizeof (struct GNUNET_MESH_TunnelKeepAlive);
char cbuf[size];
msg = (struct GNUNET_MESH_TunnelKeepAlive *) cbuf;
msg->header.size = htons (size);
+ // FIXME change to tunnel keepalive
msg->header.type = htons (GNUNET_MESSAGE_TYPE_MESH_PATH_KEEPALIVE);
msg->oid = my_full_id;
msg->tid = htonl (t->id.tid);
- /* FIXME tunnel_send_multicast (t, &msg->header); */
+ GNUNET_PEER_resolve (t->next_hop, &id);
+ send_prebuilt_message (&msg->header, &id, t);
t->path_refresh_task =
GNUNET_SCHEDULER_add_delayed (refresh_path_time, &path_refresh, t);
- tunnel_reset_timeout(t);
+ tunnel_reset_timeout (t);
}