|
|
|
|
@ -21,6 +21,7 @@ struct stream_offer {
|
|
|
|
|
struct stream_supplier { |
|
|
|
|
struct stream_supplier *next; |
|
|
|
|
uint64_t node, cycle, retry_ms; |
|
|
|
|
uint64_t local_epoch, peer_epoch; |
|
|
|
|
struct STREAM_RECEIVE *probe; |
|
|
|
|
struct stream_offer *offers; |
|
|
|
|
unsigned probe_sub, failures; |
|
|
|
|
@ -116,6 +117,7 @@ static void probes_poll(struct stream_optimizer *o, struct STREAM_HANDLE *h, uin
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
s->offers[s->probe_sub].info = info; s->failures = 0; s->retry_ms = 0; |
|
|
|
|
s->local_epoch = info.local_epoch; s->peer_epoch = info.peer_epoch; |
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_STREAM, "stream optimizer offer peer=%llx sub=%u range=%llu..%llu hops=%u" |
|
|
|
|
" rtt=%u/%d chain=%u/%d slots=%u accepting=%d lag=%llu stopped=%d age=%llu/%d queue=%llu", |
|
|
|
|
(unsigned long long)s->node, s->probe_sub, (unsigned long long)info.first_available, |
|
|
|
|
@ -228,7 +230,11 @@ static void receive_failed(struct stream_optimizer *o, struct STREAM_RECEIVE **h
|
|
|
|
|
struct stream_receive_info info; stream_receive_get_info(*handle, &info); |
|
|
|
|
struct stream_supplier *s = supplier_find(o, info.peer); |
|
|
|
|
if (s && s->offers) { |
|
|
|
|
struct stream_offer *offer = &s->offers[sub]; offer->failures++; offer->retry_ms = now + backoff(offer->failures); |
|
|
|
|
struct stream_offer *offer = &s->offers[sub]; |
|
|
|
|
int resynchronized = info.reason == STREAM_REASON_TRANSPORT && info.local_epoch && info.peer_epoch |
|
|
|
|
&& s->local_epoch && s->peer_epoch && (info.local_epoch != s->local_epoch || info.peer_epoch != s->peer_epoch); |
|
|
|
|
if (resynchronized) { offer->failures = 0; offer->retry_ms = 0; } |
|
|
|
|
else { offer->failures++; offer->retry_ms = now + backoff(offer->failures); } |
|
|
|
|
if (info.reason == STREAM_REASON_OVERLOAD) s->retry_ms = offer->retry_ms; |
|
|
|
|
} |
|
|
|
|
o->info.failures++; |
|
|
|
|
|