LibVNC / libvncserver

LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program.
GNU General Public License v2.0
1.08k stars 483 forks source link

libvncclient: using gnutls_handshake_set_timeout() #531

Closed mdevaev closed 1 year ago

mdevaev commented 2 years ago

Following #525

Removed sleep, using gnutls_handshake_set_timeout() and gnutls_system_recv_timeout(). It's working since GNUTLS 3.4.0 (released 2015-04-08).

Found a solution here: https://github.com/gnutls/gnutls/blob/857543cc24114431dd5dde0e83c2c44b9b7e6050/lib/system/fastopen.c#L167

Also a loop without sleep seems to be the regular way to use GNUTLS according to github.

bk138 commented 1 year ago

@mdevaev That looks reasonable, but why not reap the rewards and remove the busy wait in tls_gnutls.c?

mdevaev commented 1 year ago

What do you mean?

bk138 commented 1 year ago

What do you mean?

I mean the while loop here https://github.com/LibVNC/libvncserver/blob/master/libvncclient/tls_gnutls.c#L285 can probably be turned into an if.

mdevaev commented 1 year ago

As far as I understood from the documentation and examples, there really should be a loop here, because some errors may be non-fatal and it is recommended to just try handshake again.

mdevaev commented 1 year ago

Yes, you're right. Check it please now.

mdevaev commented 1 year ago

Done, check it plz

bk138 commented 1 year ago

Thanks, it's a pleasure working with you.

mdevaev commented 1 year ago

Thank you!)