|
|
|
@ -143,6 +143,10 @@ static void flow_close(struct STREAM_RECEIVE *f, int reason, int notify) { |
|
|
|
else if (!f->outgoing) route_control(p, m, &payload, 1); |
|
|
|
else if (!f->outgoing) route_control(p, m, &payload, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
f->info.state = STREAM_RECEIVE_CLOSED; f->info.reason = reason; |
|
|
|
f->info.state = STREAM_RECEIVE_CLOSED; f->info.reason = reason; |
|
|
|
|
|
|
|
if (reason != STREAM_REASON_STOPPED) |
|
|
|
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_STREAM, "stream issuance failure peer=%llx handle=%llu sub=%u reason=%d next=%llu", |
|
|
|
|
|
|
|
(unsigned long long)f->info.peer, (unsigned long long)f->info.handle, f->subblock, |
|
|
|
|
|
|
|
reason, (unsigned long long)f->info.next); |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "stream issuance closed peer=%llx group=%llx source=%llx handle=%llu sub=%u out=%d reason=%d blocks=%llu", |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_STREAM, "stream issuance closed peer=%llx group=%llx source=%llx handle=%llu sub=%u out=%d reason=%d blocks=%llu", |
|
|
|
(unsigned long long)f->info.peer, (unsigned long long)f->descriptor.group_id, |
|
|
|
(unsigned long long)f->info.peer, (unsigned long long)f->descriptor.group_id, |
|
|
|
(unsigned long long)f->descriptor.source_node_id, (unsigned long long)f->info.handle, f->subblock, |
|
|
|
(unsigned long long)f->descriptor.source_node_id, (unsigned long long)f->info.handle, f->subblock, |
|
|
|
@ -492,7 +496,11 @@ static void dispatch(struct stream_network *net, uint64_t sender, const uint8_t |
|
|
|
} |
|
|
|
} |
|
|
|
struct stream_peer *p = peer_find(net, sender); |
|
|
|
struct stream_peer *p = peer_find(net, sender); |
|
|
|
if (routed && m.command == STREAM_CMD_REVERSE_REQ) { |
|
|
|
if (routed && m.command == STREAM_CMD_REVERSE_REQ) { |
|
|
|
if (m.length || m.handle || m.receiver_epoch || !authorized(net, sender, &m, &local)) return; |
|
|
|
if (m.length || m.handle || m.receiver_epoch) { |
|
|
|
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_STREAM, "stream REVERSE_REQ malformed peer=%llx bytes=%zu handle=%llu receiver_epoch=%llx", |
|
|
|
|
|
|
|
(unsigned long long)sender, m.length, (unsigned long long)m.handle, (unsigned long long)m.receiver_epoch); return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!authorized(net, sender, &m, &local)) return; |
|
|
|
if (!p) p = peer_open(net, sender); |
|
|
|
if (!p) p = peer_open(net, sender); |
|
|
|
if (p) { p->idle = get_time_tb(); DEBUG_INFO(DEBUG_CATEGORY_STREAM, "stream REVERSE_REQ peer=%llx attempt=%llx NCD=%p", |
|
|
|
if (p) { p->idle = get_time_tb(); DEBUG_INFO(DEBUG_CATEGORY_STREAM, "stream REVERSE_REQ peer=%llx attempt=%llx NCD=%p", |
|
|
|
(unsigned long long)sender, (unsigned long long)m.sender_epoch, (void *)p->ncd); } |
|
|
|
(unsigned long long)sender, (unsigned long long)m.sender_epoch, (void *)p->ncd); } |
|
|
|
@ -502,7 +510,11 @@ static void dispatch(struct stream_network *net, uint64_t sender, const uint8_t |
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_STREAM, "stream routed DATA/control forbidden command=%u", m.command); return; |
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_STREAM, "stream routed DATA/control forbidden command=%u", m.command); return; |
|
|
|
} |
|
|
|
} |
|
|
|
if (m.command == STREAM_CMD_INFO_REQ && !routed) { |
|
|
|
if (m.command == STREAM_CMD_INFO_REQ && !routed) { |
|
|
|
if (m.handle || m.length || m.subblock >= local.descriptor.n || !authorized(net, sender, &m, &local)) return; |
|
|
|
if (m.handle || m.length || m.subblock >= local.descriptor.n) { |
|
|
|
|
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_STREAM, "stream INFO_REQ malformed peer=%llx bytes=%zu handle=%llu sub=%u n=%u", |
|
|
|
|
|
|
|
(unsigned long long)sender, m.length, (unsigned long long)m.handle, m.subblock, local.descriptor.n); return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!authorized(net, sender, &m, &local)) return; |
|
|
|
if (!p) p = peer_open(net, sender); |
|
|
|
if (!p) p = peer_open(net, sender); |
|
|
|
if (!p || (m.receiver_epoch && m.receiver_epoch != p->own_epoch)) return; |
|
|
|
if (!p || (m.receiver_epoch && m.receiver_epoch != p->own_epoch)) return; |
|
|
|
if (p->other_epoch && p->other_epoch != m.sender_epoch) { |
|
|
|
if (p->other_epoch && p->other_epoch != m.sender_epoch) { |
|
|
|
|