sustrik / dsock

An obsolete project
Other
82 stars 23 forks source link

Fix API expectations #40

Closed vlm closed 7 years ago

vlm commented 7 years ago

According to revamp:

Function “detach” MUST return the handle of the underlying protocol in case of success.

sustrik commented 7 years ago

The patch looks good. There's one more thing to check though: After detach have been called, all the pending data from TLS protocol must be cleaned up and the underlying socket can be used to run a different protocol. I am not familiar with OpenSSL, so it's hard for me to tell whether that's the case. btls_wait_close() looks a bit suspicious though. Can you have a look?

vlm commented 7 years ago

@sustrik , sorry I am missing what are you trying to say here. Could you rephrase?

sustrik commented 7 years ago
  1. Open a TLS connection.
  2. Detach both ends of the connection, get raw TCP sockets.
  3. If either side reads from TCP is it guaranteed not to receive some leftover TLS data?
vlm commented 7 years ago

Oh. This patch (or some modification thereof) is necessary to be able to cleanly close the file descriptors. There's no way to cleanly close TLS without this patch.

The attach-after-detach, or use-tcp-after-dropping-tls is something that has to be tested, but it is a secondary problem.

sustrik commented 7 years ago

Ok, merged. Let's keep the cleanup problem in mind though.