Closed Jorropo closed 10 months ago
This is a quirk of crypto/tls that I run into every time I want to play around with crypto/tls: you need to call Read
to drive the handshake on the server side, and you need to call Write
(iirc) on the client side to make sure that the handshake actually completes. Not a fan of this API, but there's not much we can do about it.
Or put differently, there's not much that needs to be done about this, since libp2p is running protocols on top of the TLS connection, so the two properties are always satisfied when using this package with libp2p. This still makes it annoying to use for microbenchmarks, but we can probably live with that.
@Jorropo Is there anything you think we should do here, or can we close the issue?
It's fine, it handles them after the handshake has been completed. Thx for clarifying this.
Version Information
While writing benchmarks for #2650 I originally wrote:
This works with noise but with tls I get:
So I changed it that way:
In english, I only close on side and the other side pretty wait for it by calling
.Read
which fixed the issue. This sounds like a bug that could impact production nodes, by making close that should go through fail and wait for timeout.This maybe be a bug in
crypto/tls
.p2p/security/noise
does not have this issue and return nil nil. (I am not actually sure if noise implements authentified closings, but I hope it does).