Diff
Bounty program for improvements to Tcl and certain Tcl packages.

Differences From Artifact [3cea59bdcb]:

To Artifact [48013cc12f]:


192
193
194
195
196
197
198

199
200
201
202
203
204
205
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
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();
			dprintf("I/O error reading, treating it as EOF");
			*errorCodePtr = 0;
			bytesRead = 0;

			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);
}