Commit Graph

28099 Commits

Author SHA1 Message Date
Jōshin
d4c63959d2
khan: try to send %socket-done on close 2021-10-30 00:28:32 +00:00
Jōshin
b532ec6ba3
vere: extract u3_reck_lily
I don't know, this is kind of awful but I'm not sure what the right
thing to do is.
2021-10-29 22:32:25 +00:00
Jōshin
c67864dc27
vere: add undocumented -h option
-h starts %khan. We don't want to run the control plane just anywhere,
to discourage Earth leaking into Mars. Using it should feel like you're
taking off the warranty sticker on your Urbit; this seems sufficient.
2021-10-29 03:07:12 +00:00
Jōshin
21f0b96413
vere: alphabetize in u3_opts 2021-10-29 03:01:25 +00:00
Jōshin
afe2427281
khan: fix typo 2021-10-27 23:54:25 +00:00
Jōshin
fcd2604b44
khan: code review input
Add a pail callback for poke vailure. Add some comments. Switch from
sync to async newt reads.
2021-10-26 20:15:48 +00:00
Jōshin
f47c00abbc
newt: decode no longer crashes on bad length
Replaced the assert with a return of c3n, which the call site responds
to by logging the message, calling bal_f, and freeing the buffer.
2021-10-26 20:14:17 +00:00
Jōshin
0237415d04
khan: bail properly
Fixed a stupid bug in the handle-other case (left an ampersand when I
stripped out the ->mor_u). void* considered awesome.
2021-10-23 06:16:46 +00:00
Jōshin
cf8b54dd20
khan: bail on unknown effects
Also move sev_l into kick, and do some whitespace cleanup.
2021-10-22 21:53:32 +00:00
Jōshin
2e12d3792e
khan: special case removing chan at list head 2021-10-22 21:45:11 +00:00
Jōshin
ed7c33e070
khan: store connection number on u3_shan
Prevents us resetting connection count to 1 if all connections
disconnect.
2021-10-22 21:39:18 +00:00
Jōshin
a12970a77b
khan: remove %set-config stub 2021-10-22 20:50:08 +00:00
Jōshin
c198c19902
khan: u3z in _khan_ef_handle 2021-10-22 17:57:42 +00:00
Jōshin
b26a1ead01
khan: comment 2021-10-22 17:47:25 +00:00
Jōshin
65c25995ad
khan: send errors over socket
Also:

- More precise TODOs.

- Send %cue-none rather than %'bad jar' on cue failure.
2021-10-22 17:45:02 +00:00
Jōshin
2d03b40b4c
khan: no we don't 2021-10-22 05:29:08 +00:00
Jōshin
0107c83252
khan: full round trip achieved
We now take %avow effects and send them back over the wire as a jammed
noun.

At this point the basic driver functionality is in place and should be
working. Still needed to finish this off are:

- Error-handling in the case of a malformed jammed noun.

- Handling requests to close the connection.

- Code review.
2021-10-22 05:27:45 +00:00
Jōshin
21b60615d1 khan: skeleton for effect parsing
This is a direct port from http.c, including _reck_lily, which should
probably get factored out.

We parse sequence numbers even though they aren't yet stored on the C
side, just in case we wind up needing them later.

Still not actually handling effects.
2021-10-21 07:11:26 +00:00
Jōshin
64730a3b30 khan: close stream on EOF
Also removes debug print in _khan_moor_poke.
2021-10-21 07:11:26 +00:00
Jōshin
a115dce91c nix: remove socket in boot-fake-ship 2021-10-21 07:11:26 +00:00
Jōshin
c10e2319be khan: log on unlink on exit 2021-10-21 07:11:26 +00:00
Jōshin
a48e627951 khan: constant first 2021-10-21 07:11:26 +00:00
Jōshin
b3e71b1e55 khan: send as %fyrd
With this, you can now send a jammed `[%mas ~]` with length over the
socket, and %khan will recognize it as a `%fyrd` and print out
`[%todo %mas ~]`.
2021-10-21 07:11:26 +00:00
Jōshin
1dab3898f1 khan: sending requests to vane
The vane is of course bailing all over the place, and we probably need
to handle errors better (and maybe also count task numbers / introduce
the concept of a 'request' at C level?), but we're moving...
2021-10-21 07:11:26 +00:00
Jōshin
f51137d663 khan: cue, remove obsolete read_cb 2021-10-21 07:11:26 +00:00
Jōshin
f1fee9e1d0 khan: remove ioctl include 2021-10-21 07:11:26 +00:00
Jōshin
eab4ed9477 khan: do not unlink / close unless live 2021-10-21 07:11:26 +00:00
Jōshin
77db31f187 khan: use u3_moor 2021-10-21 07:11:26 +00:00
Jōshin
b3f12cf9ba khan: minor formatting cleanup 2021-10-21 07:11:26 +00:00
Jōshin
33d269f493 khan: wip use u3_moat instead of raw uv_pipe_t
This may be scrapped or redone as I grok newt.c. All that this
accomplishes is putting the different data structure in place, declaring
intent to use.
2021-10-21 07:11:26 +00:00
Jōshin
ba76bcbc32 khan: close on uv_read_start failure
Also do some minor cleanup.
2021-10-21 07:11:26 +00:00
Jōshin
e56ab9da1d khan: refactor, fix memory issues
Goes ahead and makes the socket its own separate data structure linked
from u3_khan. Makes it easier to get proper links to everything without
fiddling with offsetof. Seems to resolve the memory corruption issues we
were seeing.

Also make an effort to shutdown / close resources on exit.
2021-10-21 07:11:26 +00:00
Jōshin
dd5b833b2d khan: fix pointer reference
Using offsetof is very gross and probably suggests something is wrong
somewhere. Maybe we should store the server configuration on a separate
object from the khan configuration? But in the case of khan there isn't
really a concept of multiple servers...

N.B. We still have memory corruption.
2021-10-21 07:11:26 +00:00
Jōshin
005f80ae0d khan: wip driver implementation
Implements the connection callback, which accepts and opens up the read
end of the pipe, then just waits. Stores open connections on u3_khan.
Uses simple incrementing connection numbers.

I noticed in here that vere/newt.c seems to implement a protocol much
like the one we're looking for; may try to switch to using that more
explicitly.

Needs more well-thought-out error handling policy in connection
callback. What do we do -- bail? Deliver a non-fatal error and drop the
connection?
2021-10-21 07:11:26 +00:00
Jōshin
4d237ca65f khan: error handling
Ye olde C style nested gotos. Have not tested edge cases thoroughly yet;
should do prior to release.
2021-10-21 07:11:26 +00:00
Jōshin
296c8f0e94 khan: open socket on %born completion 2021-10-21 07:11:26 +00:00
Jōshin
1ac2a15201 khan: use u3_Host.dir_c consistently 2021-10-21 07:11:26 +00:00
Jōshin
0922e66111 khan: thinking intensifies 2021-10-21 07:11:26 +00:00
Jōshin
d0fd562102 khan: thoughts in conn_cb 2021-10-21 07:11:25 +00:00
Jōshin
f169e48cb3 khan: no uv_connect_t, spacing 2021-10-21 07:11:25 +00:00
Jōshin
368c09d86d khan: sequence number before socket open 2021-10-21 07:11:25 +00:00
Jōshin
9a9455d442 khan: TODO, init pipe after unlink 2021-10-21 07:11:25 +00:00
Jōshin
bcc97b728e khan: assert name 2021-10-21 07:11:25 +00:00
Jōshin
0fa6a70801 khan: unlink socket on close
Made URB_SOCK_PATH an array instead of pointer as well, to be able to
use sizeof.
2021-10-21 07:11:25 +00:00
Jōshin
c1f38c7397 http: check return of snprintf
Purely cautionary / defensive programming; no reason to think this would
have been a problem.
2021-10-21 07:11:25 +00:00
Jōshin
fc95d7ded7 khan: listening on socket 2021-10-21 07:11:25 +00:00
Jōshin
f2df8b83d5 khan: io driver skeleton 2021-10-21 07:11:25 +00:00
Jōshin
0102bb271f behn: comment spacing 2021-10-21 07:11:25 +00:00
Joe Bryan
5ad4548ed5
Merge pull request #5323 from urbit/jb/ur-jam-overflow
vere: fixes buffer overflow in off-loom jam
2021-10-12 13:16:09 -07:00
Joe Bryan
94878e695e ur: fixes preorder handle destructor in jam handle destructor 2021-10-12 11:34:09 -04:00