︙ | | |
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
-
+
|
}
#ifdef TCLTLS_SSL_USE_FASTPATH
/*
* If the channel can be mapped back to a file descriptor, just use the file descriptor
* with the SSL library since it will likely be optimized for this.
*/
parentChannel = Tls_GetParent(statePtr);
parentChannel = Tls_GetParent(statePtr, 0);
parentChannelType = Tcl_GetChannelType(parentChannel);
validParentChannelFd = 0;
if (strcmp(parentChannelType->typeName, "tcp") == 0) {
tclGetChannelHandleRet = Tcl_GetChannelHandle(parentChannel, TCL_READABLE, (ClientData) &parentChannelFdIn_p);
if (tclGetChannelHandleRet == TCL_OK) {
tclGetChannelHandleRet = Tcl_GetChannelHandle(parentChannel, TCL_WRITABLE, (ClientData) &parentChannelFdOut_p);
|
︙ | | |
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
|
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
|
+
-
+
|
}
}
}
if (validParentChannelFd) {
dprintf("We found a shortcut, this channel is backed by a file descriptor: %i", parentChannelFdIn);
bio = BIO_new_socket(parentChannelFd, flags);
statePtr->flags |= TLS_TCL_FASTPATH;
return(bio);
}
dprintf("Falling back to Tcl I/O for this channel");
#endif
bio = BIO_new(BioMethods);
BIO_set_data(bio, statePtr);
BIO_set_shutdown(bio, flags);
BIO_set_init(bio, 1);
return(bio);
}
static int BioWrite(BIO *bio, CONST char *buf, int bufLen) {
Tcl_Channel chan;
int ret;
int tclEofChan;
chan = Tls_GetParent((State *) BIO_get_data(bio));
chan = Tls_GetParent((State *) BIO_get_data(bio), 0);
dprintf("[chan=%p] BioWrite(%p, <buf>, %d)", (void *)chan, (void *) bio, bufLen);
ret = Tcl_WriteRaw(chan, buf, bufLen);
tclEofChan = Tcl_Eof(chan);
|
︙ | | |
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
-
+
|
}
static int BioRead(BIO *bio, char *buf, int bufLen) {
Tcl_Channel chan;
int ret = 0;
int tclEofChan;
chan = Tls_GetParent((State *) BIO_get_data(bio));
chan = Tls_GetParent((State *) BIO_get_data(bio), 0);
dprintf("[chan=%p] BioRead(%p, <buf>, %d)", (void *) chan, (void *) bio, bufLen);
if (buf == NULL) {
return 0;
}
|
︙ | | |
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
-
+
|
return BioWrite(bio, str, (int) strlen(str));
}
static long BioCtrl(BIO *bio, int cmd, long num, void *ptr) {
Tcl_Channel chan;
long ret = 1;
chan = Tls_GetParent((State *) BIO_get_data(bio));
chan = Tls_GetParent((State *) BIO_get_data(bio), 0);
dprintf("BioCtrl(%p, 0x%x, 0x%x, %p)", (void *) bio, (unsigned int) cmd, (unsigned int) num, (void *) ptr);
switch (cmd) {
case BIO_CTRL_RESET:
dprintf("Got BIO_CTRL_RESET");
num = 0;
|
︙ | | |