Re: Graceful shutdown of TLS connection for blocking sockets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/8/2017 4:17 AM, Kyle Hamilton wrote:
The way to handle this situation is simply to never enter SSL_read() if
there isn't anything to read on the socket.  select() or pselect() are your
friends, here, because they'll tell you if there's data to read from the
underlying file descriptor.

I hope this helps!

-Kyle H

Since the OP is talking about blocking sockets, I'm going to reiterate something someone pointed out to me on this very list many years ago and save someone a LOT of headaches:

select() should NEVER, EVER be used for blocking sockets.


Just because select() returns any given descriptor doesn't mean that a call won't still block when working with blocking sockets. select() is for non-blocking descriptors ONLY. The amount of extra code involved for handling non-blocking sockets is actually quite minimal when a state engine is adopted.

I'd love to see select() implementations raise an exception and kill the whole application off when passing it a blocking descriptor. Then we would discover how much broken software is floating around out there. Since I still see lots of recommendations for using select() with blocking descriptors and all of the official system-level documentation for select() is silent on this issue, I'm guessing a lot.

--
Thomas Hruska
Shining Light Productions

Home of BMP2AVI and Win32 OpenSSL.
http://www.slproweb.com/
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux