Check-in [4579316443]

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

Overview
Comment:Cleaned up more things
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wip-fix-io-layer
Files: files | file ages | folders
SHA1:4579316443ead0f83eb3d01a2924e31873856330
User & Date: rkeene 2016-12-13 03:35:25
Context
2016-12-13
03:40
Fixed uninitialized use of variable check-in: 942e844672 user: rkeene tags: wip-fix-io-layer
03:35
Cleaned up more things check-in: 4579316443 user: rkeene tags: wip-fix-io-layer
03:27
Silence warnings about ignoring this return value by explicitly ignoring it check-in: 41f972bfbf user: rkeene tags: wip-fix-io-layer
Changes

Changes to tlsIO.c.

   156    156    *	0 if successful, the value of Tcl_GetErrno() if failed.
   157    157    *
   158    158    * Side effects:
   159    159    *	Closes the socket of the channel.
   160    160    *
   161    161    *-------------------------------------------------------------------
   162    162    */
   163         -static int
   164         -TlsCloseProc(ClientData instanceData,	/* The socket to close. */
   165         -             Tcl_Interp *interp)	/* For error reporting - unused. */
   166         -{
   167         -    State *statePtr = (State *) instanceData;
          163  +static int TlsCloseProc(ClientData instanceData, Tcl_Interp *interp) {
          164  +	State *statePtr = (State *) instanceData;
   168    165   
   169         -    dprintf("TlsCloseProc(%p)", (void *) statePtr);
          166  +	dprintf("TlsCloseProc(%p)", (void *) statePtr);
   170    167   
   171         -    Tls_Clean(statePtr);
   172         -    Tcl_EventuallyFree((ClientData)statePtr, Tls_Free);
          168  +	Tls_Clean(statePtr);
          169  +	Tcl_EventuallyFree((ClientData)statePtr, Tls_Free);
   173    170   
   174         -    dprintf("Returning TCL_OK");
          171  +	dprintf("Returning TCL_OK");
   175    172   
   176         -    return TCL_OK;
          173  +	return(TCL_OK);
          174  +
          175  +	/* Interp is unused. */
          176  +	interp = interp;
   177    177   }
   178    178   
   179    179   /*
   180    180    *-------------------------------------------------------------------
   181    181    *
   182    182    * TlsInputProc --
   183    183    *
................................................................................
   263    263   			break;
   264    264   		case SSL_ERROR_SYSCALL:
   265    265   			dprintf("I/O error reading, treating it as EOF");
   266    266   			*errorCodePtr = 0;
   267    267   			bytesRead = 0;
   268    268   			break;
   269    269   	}
   270         -input:
          270  +
   271    271   	dprintf("Input(%d) -> %d [%d]", bufSize, bytesRead, *errorCodePtr);
   272    272   	return bytesRead;
   273    273   }
   274    274   
   275    275   /*
   276    276    *-------------------------------------------------------------------
   277    277    *
................................................................................
   312    312   		dprintf("Tls_WaitForConnect returned %i (err = %i)", written, *errorCodePtr);
   313    313   
   314    314   		return(-1);
   315    315   	}
   316    316   
   317    317   	if (toWrite == 0) {
   318    318   		dprintf("zero-write");
   319         -		BIO_flush(statePtr->bio);
          319  +		err = BIO_flush(statePtr->bio);
          320  +
          321  +		if (err <= 0) {
          322  +			dprintf("Flushing failed");
          323  +
          324  +			*errorCodePtr = EIO;
          325  +			written = 0;
          326  +			return(-1);
          327  +		}
          328  +
   320    329   		written = 0;
   321    330   		*errorCodePtr = 0;
   322    331   		return(0);
   323    332   	}
   324    333   
   325    334   	/*
   326    335   	 * We need to clear the SSL error stack now because we sometimes reach
................................................................................
   367    376   			*errorCodePtr = ECONNABORTED;
   368    377   			written = -1;
   369    378   			break;
   370    379   		default:
   371    380   			dprintf(" unknown err: %d", err);
   372    381   			break;
   373    382   	}
   374         -output:
          383  +
   375    384   	dprintf("Output(%d) -> %d", toWrite, written);
   376    385   	return(written);
   377    386   }
   378    387   
   379    388   /*
   380    389    *-------------------------------------------------------------------
   381    390    *
................................................................................
   773    782   
   774    783   			err = SSL_connect(statePtr->ssl);
   775    784   		}
   776    785   
   777    786   		if (err > 0) {
   778    787   			dprintf("That seems to have gone okay");
   779    788   
   780         -			BIO_flush(statePtr->bio);
          789  +			err = BIO_flush(statePtr->bio);
          790  +
          791  +			if (err <= 0) {
          792  +				dprintf("Flushing the lower layers failed, this will probably terminate this session");
          793  +			}
   781    794   		}
   782    795   
   783    796   		rc = SSL_get_error(statePtr->ssl, err);
   784    797   
   785    798   		dprintf("Got error: %i (rc = %i)", err, rc);
   786    799   
   787    800   		bioShouldRetry = 0;