The larger problem here is that straightforward select() just doesn't
work with SSL-wrapped sockets. If you depend on it for liveness, your
program will eventually hang up.
When packets in SSL arrive at a destination, they are pulled off the
socket in chunks of sizes controlled by the encryption protocol being
used, decrypted, and placed in SSL-internal buffers. The buffer content
is then transferred to the application program through SSL_read(). If
you've read only part of the decrypted data, there will still be pending
input data on the SSL connection, but it won't show up on the underlying
file descriptor via select(). Your code needs to call SSL_pending()
explicitly to see if there is any pending data to be read.