Posted to tcl by aspect at Tue Jul 08 07:59:13 GMT 2014view raw

  1. Comparing with unix/tclUnixSock.c, TLS doesn't to as much to be aware of sockets in async connecting state. Perhaps it doesn't need to. In any case, the below check seems to be required to handle sockets in connection-pending state when Tls_WaitForConnect is called from TlsOutputProc.
  2.  
  3. The same issue may also manifest in other places, and/or the below could be wrong but it does make my tests pass. See previous paste for details of test.
  4.  
  5.  
  6. See http://core.tcl.tk/tcl/info/c31ca233cacd7d6184877c54182f4b3a6ccb30f1
  7.  
  8.  
  9. ===================================================================
  10. RCS file: /cvsroot/tls/tls/tlsIO.c,v
  11. retrieving revision 1.16
  12. diff -u -r1.16 tlsIO.c
  13. --- tlsIO.c 22 Jun 2007 21:20:38 -0000 1.16
  14. +++ tlsIO.c 8 Jul 2014 07:47:01 -0000
  15. @@ -891,7 +891,8 @@
  16. (char *)ERR_reason_error_string(ERR_get_error()));
  17. *errorCodePtr = ECONNABORTED;
  18. return -1;
  19. - } else if (BIO_should_retry(statePtr->bio)) {
  20. + } else if (BIO_should_retry(statePtr->bio)
  21. + || (rc == SSL_ERROR_SYSCALL && err == EAGAIN)) {
  22. if (statePtr->flags & TLS_TCL_ASYNC) {
  23. dprintf(stderr,"E! ");
  24. *errorCodePtr = EAGAIN;
  25.