Check-in [9bb0350edb]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More debugging
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tls-1-7
Files: files | file ages | folders
SHA1:9bb0350edb0349a57a6895ad6c97ddb53cb24063
User & Date: rkeene 2016-12-07 14:51:03
Context
2016-12-07
14:56
Updated to store the Tcl EOF flag, in case it gets reset in between calls -- causing debugging builds to operate differently than normal builds check-in: 28b99767e9 user: rkeene tags: tls-1-7
14:51
More debugging check-in: 9bb0350edb user: rkeene tags: tls-1-7
14:43
More debugging around TLS retries check-in: e84900f887 user: rkeene tags: tls-1-7
Changes

Changes to tlsBIO.c.

    82     82       BIO *bio;
    83     83       char *buf;
    84     84       int bufLen;
    85     85   {
    86     86       Tcl_Channel chan = Tls_GetParent((State*)bio->ptr);
    87     87       int ret = 0;
    88     88   
    89         -    dprintf("BioRead(%p, <buf>, %d) [%p]",
    90         -	    (void *) bio, bufLen, (void *) chan);
           89  +    dprintf("BioRead(%p, <buf>, %d) [%p]", (void *) bio, bufLen, (void *) chan);
    91     90   
    92     91       if (buf == NULL) return 0;
    93     92   
    94     93       if (channelTypeVersion == TLS_CHANNEL_VERSION_2) {
    95     94   	ret = Tcl_ReadRaw(chan, buf, bufLen);
    96     95       } else {
    97     96   	ret = Tcl_Read(chan, buf, bufLen);
    98     97       }
    99     98   
   100         -    dprintf("[%p] BioRead(%d) -> %d [%d.%d]",
           99  +    dprintf("[%p] BioRead(%d) -> %d [tclEof=%d; tclErrno=%d]",
   101    100   	    (void *) chan, bufLen, ret, Tcl_Eof(chan), Tcl_GetErrno());
   102    101   
   103    102       BIO_clear_flags(bio, BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY);
   104    103   
   105    104       if (ret == 0) {
   106    105   	if (!Tcl_Eof(chan)) {
          106  +            dprintf("Got 0 from Tcl_Read or Tcl_ReadRaw, and EOF is set -- ret == -1 now");
   107    107   	    BIO_set_retry_read(bio);
   108    108   	    ret = -1;
   109    109   	}
   110    110       }
   111    111       if (BIO_should_write(bio)) {
   112    112   	BIO_set_retry_write(bio);
   113    113       }
          114  +
          115  +    dprintf("BioRead(%p, <buf>, %d) [%p] returning %i", (void *) bio, bufLen, (void *) chan, ret);
          116  +
   114    117       return ret;
   115    118   }
   116    119   
   117    120   static int
   118    121   BioPuts	(bio, str)
   119    122       BIO *bio;
   120    123       CONST char *str;

Changes to tlsIO.c.

   332    332   
   333    333       *errorCodePtr = 0;
   334    334   
   335    335       dprintf("BIO_read(%d)", bufSize);
   336    336   
   337    337       if (statePtr->flags & TLS_TCL_CALLBACK) {
   338    338          /* don't process any bytes while verify callback is running */
          339  +       dprintf("Callback is running, reading 0 bytes");
          340  +
   339    341          bytesRead = 0;
   340    342          goto input;
   341    343       }
   342    344   
   343    345       if (!SSL_is_init_finished(statePtr->ssl)) {
   344    346   	bytesRead = Tls_WaitForConnect(statePtr, errorCodePtr);
   345    347   	if (bytesRead <= 0) {
          348  +            dprintf("Got an error (bytesRead = %i)", bytesRead);
          349  +
   346    350   	    if (*errorCodePtr == ECONNRESET) {
          351  +                dprintf("Got connection reset");
   347    352   		/* Soft EOF */
   348    353   		*errorCodePtr = 0;
   349    354   		bytesRead = 0;
   350    355   	    }
   351    356   	    goto input;
   352    357   	}
   353    358       }