Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge with private mirror #143

Closed
wants to merge 38 commits into from
Closed

Conversation

sergiu128
Copy link
Collaborator

No description provided.

TobiasBrandt-Talos and others added 30 commits August 20, 2024 12:01
* Add upgrade request/response callbacks

These callbacks are invoked during the handshake just before the
upgrade request is sent and just after the response is received.

* Add websocket rtt example
* Add docs
* Update gosec build step

* IO can unset reads/writes

* Close() unsets reads+writes and deregisters the IO slot

* AsyncAdapter exposes its IO Slot
No need for Blocking and Nonblocking variants anymore as all reads and writes are dispatched through the underlying
ByteBuffer which in turns dispatches calls to a specific Stream interface. That Stream interface is ultimately
responsible for dispatching reads/writes in a blocking or non-blocking way.
The Frame is now a []byte slice and not a struct with 3 slices:
header, mask, payload.

SetFIN, SetOpcode etc employ the builder pattern to make a frame.
And not globally, per all streams.
Will be refered to as websocket.Stream.
With a ProtocolError. The close frame must be explicitly flushed
by callers, for now.
The connection should fail with 1002/Protocol error if any
of the RSV1/2/3 bits are set.
Use the one from the slot, as we do in packet.go.
This ensures we also prevent stack overflows when two objects build up
each other's stackframes. See TestDispatchLimit for such a case.
In file.go and conn.go
Instead of creating the asynchronous callback with getReadHandler
we now store the async state in fileReadReactor which is allocated
once. This is identical to how multicast/peer.go does async reads,
so the mechanism is well-tested.
Same reasoning as the previous commit, but for writes.
I probably messed up a diff somewhere. The public repo
is now in sync with the private mirror.
Otherwise we will mark the connection as successful and a subsequent read/write will return EOF. In reality, the connect
syscall failed. Checking the return value of Getsockoptint(... SO_ERROR) will tell us whether the connect syscall
succeeded. A return value of 0 means success - anything else can be interpreted by syscall.Errno and means failure.

I was mislead into thinking the returned `err` from `Getsockoptint` is the actual socket error - in reality, it's whether the `getsockopt` syscall succeeded or not.

- Golang src: https://github.com/golang/go/blob/04879acdebbb08bdca00356f043d769c4b4375ce/src/syscall/syscall_unix.go#L312
- Sanity check that uninit values are set to 0: https://go.dev/play/p/vCLjDd6WwL-
- syscall.Errno is safe for any input value: https://cs.opensource.google/go/go/+/refs/tags/go1.23.3:src/syscall/syscall_unix.go;l=110
@sergiu128 sergiu128 closed this Nov 27, 2024
@sergiu128 sergiu128 deleted the sergiu/merge-with-private-mirror branch November 27, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants