Check-in [538876ebf5]
Overview
Comment:Enhanced support for syscall error checking from BIOs
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 538876ebf5042115ebfa76fc5ea93238b2a5d982
User & Date: rkeene on 2016-12-13 07:19:34
Other Links: manifest | tags
Context
2016-12-13
07:42
Updated I/O handling to properly deal with errors and passing that error code up the stack check-in: fe1f0ecd35 user: rkeene tags: trunk
07:19
Enhanced support for syscall error checking from BIOs check-in: 538876ebf5 user: rkeene tags: trunk
07:06
Updated to include a pre-made tls.tcl.h in the distribution check-in: 18f663c190 user: rkeene tags: trunk
Changes

Modified tlsIO.c from [3cea59bdcb] to [48013cc12f].

192
193
194
195
196
197
198

199
200
201
202
203
204
205
 * Side effects:
 *	Reads input from the input device of the channel.
 *
 *-------------------------------------------------------------------
 */

static int TlsInputProc(ClientData instanceData, char *buf, int bufSize, int *errorCodePtr) {

	State *statePtr = (State *) instanceData;
	int bytesRead;
	int tlsConnect;
	int err;

	*errorCodePtr = 0;








>







192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
 * Side effects:
 *	Reads input from the input device of the channel.
 *
 *-------------------------------------------------------------------
 */

static int TlsInputProc(ClientData instanceData, char *buf, int bufSize, int *errorCodePtr) {
	unsigned long backingError;
	State *statePtr = (State *) instanceData;
	int bytesRead;
	int tlsConnect;
	int err;

	*errorCodePtr = 0;

253
254
255
256
257
258
259

260


261
262






263
264
265
266
267
268
269
			dprintBuffer(buf, bytesRead);
			break;
		case SSL_ERROR_SSL:
			Tls_Error(statePtr, TCLTLS_SSL_ERROR(statePtr->ssl, bytesRead));
			*errorCodePtr = ECONNABORTED;
			break;
		case SSL_ERROR_SYSCALL:

			dprintf("I/O error reading, treating it as EOF");


			*errorCodePtr = 0;
			bytesRead = 0;






			break;
	}

	dprintf("Input(%d) -> %d [%d]", bufSize, bytesRead, *errorCodePtr);
	return(bytesRead);
}








>
|
>
>
|
|
>
>
>
>
>
>







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
			dprintBuffer(buf, bytesRead);
			break;
		case SSL_ERROR_SSL:
			Tls_Error(statePtr, TCLTLS_SSL_ERROR(statePtr->ssl, bytesRead));
			*errorCodePtr = ECONNABORTED;
			break;
		case SSL_ERROR_SYSCALL:
			backingError = ERR_get_error();

			if (backingError == 0 && err == 0) {
				dprintf("EOF reached")
				*errorCodePtr = 0;
				bytesRead = 0;
			} else {
				dprintf("I/O error occured (backingError = %lu)", backingError);
				*errorCodePtr = backingError;
				bytesRead = 0;
			}

			break;
	}

	dprintf("Input(%d) -> %d [%d]", bufSize, bytesRead, *errorCodePtr);
	return(bytesRead);
}