diff --git a/overlay_address.c b/overlay_address.c index 14335645..d9442a13 100644 --- a/overlay_address.c +++ b/overlay_address.c @@ -395,6 +395,12 @@ static int add_explain_response(struct subscriber *subscriber, void *context){ response->please_explain->payload=ob_new(); ob_limitsize(response->please_explain->payload, 1024); } + + // if one of our identities is unknown, + // the header of our next payload must include our full sid. + if (subscriber->reachable==REACHABLE_SELF) + subscriber->send_full = 1; + // add the whole subscriber id to the payload, stop if we run out of space DEBUGF("Adding full sid by way of explanation %s", alloca_tohex_sid(subscriber->sid)); if (ob_append_bytes(response->please_explain->payload, subscriber->sid, SID_SIZE)) diff --git a/overlay_interface.c b/overlay_interface.c index 8b0a9d40..1cd5c250 100644 --- a/overlay_interface.c +++ b/overlay_interface.c @@ -619,7 +619,7 @@ void overlay_dummy_poll(struct sched_ent *alarm) /* if there's no input, while we want to check for more soon, we need to allow all other low priority alarms to fire first, otherwise we'll dominate the scheduler without accomplishing anything */ - alarm->alarm = gettime_ms() + 20; + alarm->alarm = gettime_ms() + 5; if (interface->last_tick_ms != -1 && alarm->alarm > interface->last_tick_ms + interface->tick_ms) alarm->alarm = interface->last_tick_ms + interface->tick_ms; alarm->deadline = alarm->alarm + 10000; @@ -633,8 +633,8 @@ void overlay_dummy_poll(struct sched_ent *alarm) if (nread == -1) WHY_perror("read"); else { - interface->recv_offset += nread; if (nread == sizeof packet) { + interface->recv_offset += nread; plen = packet[110] + (packet[111] << 8); if (plen > nread - 128) plen = -1; @@ -658,9 +658,12 @@ void overlay_dummy_poll(struct sched_ent *alarm) } } /* keep reading new packets as fast as possible, - but don't prevent other high priority alarms */ - alarm->alarm = gettime_ms(); - alarm->deadline = alarm->alarm + 200; + but don't completely prevent other high priority alarms */ + if (interface->recv_offset >= length) + alarm->alarm = gettime_ms() + 5; + else + alarm->alarm = gettime_ms(); + alarm->deadline = alarm->alarm + 100; } schedule(alarm); diff --git a/overlay_packetformats.c b/overlay_packetformats.c index cc719cc6..1796c2a8 100644 --- a/overlay_packetformats.c +++ b/overlay_packetformats.c @@ -258,6 +258,10 @@ int packetOkOverlay(struct overlay_interface *interface,unsigned char *packet, s if (f.type==OF_TYPE_SELFANNOUNCE){ sender = f.source; + // skip the entire packet if it came from me + if (sender->reachable==REACHABLE_SELF) + break; + overlay_address_set_sender(f.source); // if this is a dummy announcement for a node that isn't in our routing table