[openssl-users] Graceful shutdown of TLS connection for blocking sockets

Jakob Bohm jb-openssl at wisemo.com
Mon Oct 9 14:29:25 UTC 2017


On 09/10/2017 15:31, Thomas J. Hruska wrote:
> On 10/9/2017 1:32 AM, Michel wrote:
>>> With blocking sockets, you just loop back around and repeat the same 
>>> call
>> if either of those messages are returned by SSL_get_error(). No select()
>> required.
>>
>> Yes, you have to repeat the same call, but select() is still usefull,
>> especially with blocking sockets.
>
> And leads to incorrect code and weird blocking scenarios.  Been there, 
> done that.  You're using select() wrong.  If you want to block, then 
> block and don't try to hack around it.  Otherwise use non-blocking.
>
> This common misunderstanding of select() is precisely why calling it 
> with a blocking descriptor should trigger an exception that kills the 
> application.  Doing so would bring a quick end to a lot of bad code.
>
The system documentation (at least on Linux) isn't just silent
about how select behaves with blocking sockets.  It is
*explicitly* written to describe how it works with blocking
sockets (but is mostly silent about non-blocking sockets).
(My copy is marked as being from Linux man-pages project version
3.74).

I suggest you find a good authoritative source for your claim
that select() should not be used with blocking sockets.

Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded



More information about the openssl-users mailing list