Woot! overlay mode now emits regular tick frames on interfaces it knows about.

Still doesn't know about broadcast properly or a pile of other things, oh, and
the frames are completely empty, but none the less, we are now sending frames.
This commit is contained in:
gardners 2011-08-09 12:45:24 +08:00
parent 92768cdcd0
commit 2ff8541049
2 changed files with 7 additions and 2 deletions

View File

@ -58,7 +58,7 @@ int ob_makespace(overlay_buffer *b,int bytes)
if (b->sizeLimit!=-1) { if (b->sizeLimit!=-1) {
if (b->length+bytes>b->sizeLimit) return WHY("Asked to make space beyond size limit"); if (b->length+bytes>b->sizeLimit) return WHY("Asked to make space beyond size limit");
} }
if (b->length+bytes<b->allocSize) if (b->length+bytes>=b->allocSize)
{ {
int newSize=b->length+bytes; int newSize=b->length+bytes;
if (newSize<64) newSize=64; if (newSize<64) newSize=64;

View File

@ -109,6 +109,10 @@ int overlay_init_interface(in_addr_t src_addr,int speed_in_bits,int port,int typ
return WHY("MP HLR server could not bind to requested UDP port (bind() failed)"); return WHY("MP HLR server could not bind to requested UDP port (bind() failed)");
} }
/* Pick a reasonable default MTU.
This will ultimately get tuned by the bandwidth and other properties of the interface */
I(mtu)=1200;
I(bits_per_second)=speed_in_bits; I(bits_per_second)=speed_in_bits;
I(port)=bind_addr.sin_port; I(port)=bind_addr.sin_port;
I(type)=type; I(type)=type;
@ -228,7 +232,7 @@ int overlay_tick_interface(int i, long long now)
component payloads are all self-authenticating, or at least that is the theory. */ component payloads are all self-authenticating, or at least that is the theory. */
unsigned char bytes[]={/* Magic */ 'O',0x10, unsigned char bytes[]={/* Magic */ 'O',0x10,
/* Version */ 0x00,0x01}; /* Version */ 0x00,0x01};
ob_append_bytes(e,bytes,4); if (ob_append_bytes(e,bytes,4)) return WHY("ob_append_bytes() refused to append magic bytes.");
/* 1. Send announcement about ourselves, including one SID that we host if we host more than one SID /* 1. Send announcement about ourselves, including one SID that we host if we host more than one SID
(the first SID we host becomes our own identity, saving a little bit of data here). (the first SID we host becomes our own identity, saving a little bit of data here).
@ -281,6 +285,7 @@ int overlay_tick_interface(int i, long long now)
/* Now send the frame. This takes the form of a special DNA packet with a different /* Now send the frame. This takes the form of a special DNA packet with a different
service code, which we setup earlier. */ service code, which we setup earlier. */
fprintf(stderr,"Sending %d bytes\n",e->length);
if (!overlay_broadcast_ensemble(i,e->bytes,e->length)) if (!overlay_broadcast_ensemble(i,e->bytes,e->length))
{ {
fprintf(stderr,"Successfully transmitted tick frame on interface #%d\n",i); fprintf(stderr,"Successfully transmitted tick frame on interface #%d\n",i);