hoche / cicb

ICB chat client. See www.icb.net
GNU General Public License v3.0
11 stars 4 forks source link

Additional SSL fixes #3

Closed 20centaurifux closed 5 years ago

20centaurifux commented 5 years ago

Hi, it's me again :)

I've noticed that there are still some SSL related issues.

  1. SSL_connect(), SSL_read() and SSL_write() have to be called again if they fail and the error code is SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE.

  2. getc_or_dispatch() hangs if there's pending data in the SSL buffer. Now the code tests if there's data available and calls read_from_server() until the buffer is empty.

With these changes cicb seems to work properly with my server implementation. There's a test instance running on internetcitizens.band:7327.

hoche commented 5 years ago

Yeah, I'd made some notes in the comments about the need to retry on WANT_READ or WANT_WRITE (after merging your last submission). This will solve that, but will spin forever if the connection stalls. We probably should either have a max-retries or timeout, particularly on the initial SSL connection. I didn't do much more than make a note about it at this point.

Also, I'm ok with the abort() in the SSL error handling, but we should notify the user the reason why. I'll probabably add in a switch statement like the one after SSL_connect() when I get back to this.