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