forwarding of overlay frames substantially in place, but requires

testing.
This commit is contained in:
gardners 2012-04-14 10:56:03 +09:30
parent 4e0c9bfd02
commit c37d83bddd
3 changed files with 25 additions and 0 deletions

View File

@ -637,6 +637,7 @@ int overlay_stuff_packet_from_queue(int i,overlay_buffer *e,int q,long long now,
}
} else {
WHY("bummer, I couldn't find an open route to that node");
printf("sid=%s\n",overlay_render_sid((*p)->destination));
}
} else if (!(*p)->broadcast_sent_via[i])
{

View File

@ -259,6 +259,29 @@ int op_free(overlay_frame *p)
return 0;
}
overlay_frame *op_dup(overlay_frame *in)
{
if (!in) return NULL;
/* clone the frame */
overlay_frame *out=malloc(sizeof(overlay_frame));
if (!out) WHYRETNULL("malloc() failed");
/* copy main data structure */
bcopy(in,out,sizeof(overlay_frame));
out->payload=ob_new(in->payload->length);
if (!out->payload) {
free(out);
WHYRETNULL("ob_new() failed");
}
if (ob_append_bytes(out->payload,&in->payload->bytes[0],in->payload->length))
{
op_free(out);
WHYRETNULL("could not duplicate payload bytes");
}
return out;
}
int overlay_frame_set_neighbour_as_source(overlay_frame *f,overlay_neighbour *n)
{
if (!n) return WHY("Neighbour was null");

View File

@ -743,6 +743,7 @@ int ob_indel_space(overlay_buffer *b,int offset,int shift);
int ob_append_rfs(overlay_buffer *b,int l);
int op_free(overlay_frame *p);
overlay_frame *op_dup(overlay_frame *f);
long long parse_quantity(char *q);