aboutsummaryrefslogtreecommitdiffstats
path: root/serve/serve.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-29 16:42:45 +0100
committereunhhu <[email protected]>2026-09-29 16:42:45 +0100
commita06b652768a8643fe76efdc80a0c6eb729268fc5 (patch)
treeaa425cbbd98037177035ef224045369262b9d2e3 /serve/serve.c
parent393804bee74311ef00e39502d7979ca00bd38cb2 (diff)
downloadpure-a06b652768a8643fe76efdc80a0c6eb729268fc5.tar.gz
pure-a06b652768a8643fe76efdc80a0c6eb729268fc5.zip
Say why a stream is refused (REFUSED), and try it again seldom
A receiver that took no records of a stream (a source the key may not send as, no input of that name, an input of another shape) said nothing: its sender heard them acknowledged, never stored, and sent them all again every second, for ever, and its operator saw nothing. Now the receiver answers REFUSED (0x0c: the names, and why), and the sender sends no records for a second, then a packet of them to learn whether they are taken now, the wait twice as long each time (64 s at most). A refusal ends when that packet is acknowledged with no REFUSED beside, or a record is stored. link.c says it once on stderr, as a wire says a receiver does not take its sends; serve's input says which of the two the app lacks. test-link: each of the three is refused seven times in 90 s with nine packets, and a stream refused until the app has its input goes on then, all 200 records stored. check.py links a node to an input its receiver lacks: said once, two packets in 2.5 s.
Diffstat (limited to 'serve/serve.c')
-rw-r--r--serve/serve.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/serve/serve.c b/serve/serve.c
index 969bf89..b271d14 100644
--- a/serve/serve.c
+++ b/serve/serve.c
@@ -2339,10 +2339,8 @@ static void stop_shard(Host *host) {
static int link_input(void *context, const char *name, uint32_t shape) {
const PureModule *m = ((Owner *)context)->executor.app.module;
int index = pure_module_input(m, name);
- if (index < 0 || m->input[index].kind != PURE_KIND_MESSAGE || m->input[index].keyed ||
- pure_module_shape(m, (uint32_t)index) != shape)
- return -1;
- return index;
+ if (index < 0 || m->input[index].kind != PURE_KIND_MESSAGE || m->input[index].keyed) return -PURE_LINK_NO_INPUT;
+ return pure_module_shape(m, (uint32_t)index) == shape ? index : -PURE_LINK_OTHER_SHAPE;
}
/* Records a link delivered, queued at the owner as a request is: applied