Repository navigation
Conversation
Author
|
Closing this in favor of #907. I reworked #907 to handle TLS connection errors without refactoring the shared RPC implementation or modifying generated code. The new approach keeps the changes smaller and more focused. The updated implementation has also been tested on Wio Terminal hardware. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The RTL8720DN driver treats only
-1as a TLS connection failure. The firmware can return other negative codes. It can also return0after it closes the socket on a connection failure.This change rejects every negative TLS result and includes the original code in the error. After a nonnegative result, it checks the internal socket. Socket
0is valid. A negative socket is an error. The error does not assume why the socket closed.The two TLS RPCs return
(int32, error). They use the shared write and read functions inrpc_util.go. The existingperformRequest()andread()methods are thin wrappers around those same functions. The shared path checks UART errors, short writes, incomplete frames, frame length, CRC, and response headers. It skips notification frames and uses the existing 2048 byte payload buffer.A failed TLS connection rejects send and receive calls. The client remains available to
Close(), which stops the socket, destroys the client, and removes its map entry. Repeated close calls do not send more RPCs.The host test tag replaces hardware setup with a test device. The tests call the driver RPC,
Connect(), andClose()methods. These socket methods are insocket.goso the tests can use them without amachinepackage.make unit-testruns the host tests.This branch starts from
upstream/devat8aae6eafa7ca. It implements the requested replacement for #907. The old branch and PR remain unchanged.Validation
make unit-testpassed.go test -race -tags rtl8720dn_hosttest ./rtl8720dnpassed.make fmt-checkandgit diff --checkpassed.examples/net/tlsclientandexamples/net/tcpclientpassed with TinyGo 0.42.0.