diff options
| author | eunhhu <[email protected]> | 2026-09-30 05:58:38 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-30 05:58:38 +0100 |
| commit | 45f6386784497bdfe3eaa7eb9b8f0104bb804267 (patch) | |
| tree | e860d4de8cd801719a2cc9880f534c8a77c63ec3 | |
| parent | 5ce7655d613689223050715ff3f8fe5c456ebf11 (diff) | |
| download | pure-45f6386784497bdfe3eaa7eb9b8f0104bb804267.tar.gz pure-45f6386784497bdfe3eaa7eb9b8f0104bb804267.zip | |
Say a node's name when pure-serve starts
A node's sends are named NAME.OUTPUT, and a receiver's --sender must say
that name. Without --name it is the module file's name without .pmod,
which nothing said: two board nodes built from board2.aup sent as
board2.changed and were refused by receivers expecting a.changed. The
first line out now carries the name beside the port and the key, and
the usage says where it comes from.
| -rw-r--r-- | serve/serve.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/serve/serve.c b/serve/serve.c index 319f165..05adf50 100644 --- a/serve/serve.c +++ b/serve/serve.c @@ -2759,8 +2759,11 @@ int main(int argc, char **argv) { return 2; } } - if (*public_key) printf("{\"port\":%u,\"threads\":%u,\"public_key\":\"%s\"}\n", port, threads, public_key); - else printf("{\"port\":%u,\"threads\":%u}\n", port, threads); + /* Its name too: its sends' sources are NAME.OUTPUT, which a receiver's --sender must name. */ + printf("{\"port\":%u,\"threads\":%u,\"name\":\"", port, threads); + for (const char *c = name; *c; ++c) printf(*c == '"' || *c == '\\' ? "\\%c" : "%c", *c); + if (*public_key) printf("\",\"public_key\":\"%s\"}\n", public_key); + else printf("\"}\n"); fflush(stdout); /* A surface reads the owner's snapshots and gives it events. */ if (surface_path && !owned) { fputs("--surface needs an app with states\n", stderr); return 2; } @@ -2855,6 +2858,8 @@ usage: " connection, docs/design/012-link-protocol.md; its key by --seal OUTPUT=KEY)\n" " --send OUTPUT=http[s]://host:port/path: to anything else, over HTTP\n" " --senders FILE: more senders the --link-port takes, a line each: NAME KEY\n" + " --name NAME: the node's name, its sends' sources being NAME.OUTPUT (the module file's name without\n" + " .pmod unless given; the first line out says it)\n" " --memory BYTES: what the app's states may hold (lists' items, texts, sends not yet stored): an event\n" " past it is refused, 503 memory (docs/design/013-memory-budget.md)\n" " --window BYTES: what each --send holds of its sends beyond what its receiver has (and 65,536 sends);\n" |
