[OpenSIPS-Devel] SF.net SVN: opensips:[7561] trunk/tls/tls_server.c

Bogdan-Andrei Iancu bogdan at voice-system.ro
Fri Dec 17 09:38:39 CET 2010


Revision: 7561
          http://opensips.svn.sourceforge.net/opensips/?rev=7561&view=rev
Author:   bogdan_iancu
Date:     2010-12-17 08:38:38 +0000 (Fri, 17 Dec 2010)

Log Message:
-----------
- fixed handling of WANT_READ / WANT_WRITE events in TLS code. Description:
  
tls_blocking_write() polls for both POLLOUT and POLLIN at the same time. Normally, socket is ready for write all the time. It causes poll() at line 765 returned immediately.

When using t_relay("tls:xxx") in script, I always get "too many retries with no operation" error message because poll() function returns immediately.

I read the OpenSSL doc http://www.openssl.org/docs/ssl/SSL_connect.html and http://www.openssl.org/docs/ssl/SSL_get_error.html#item_SSL_ERROR_WANT_READ.
When SSL_connect(), SSL_read(), or SSL_write() return SSL_ERROR_WANT_READ, tls_blocking_write() should poll for POLLIN only. And when they return SSL_ERROR_WANT_WRITE, tls_blocking_write() should poll for POLLOUT only.

I think this bug also makes CPU usage to be 100% while looping.


Credits for the fix go to Worawit Wang.

Closes Bug report #3061895
Closes Patch #3118263

Modified Paths:
--------------
    trunk/tls/tls_server.c


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Devel mailing list