Overview
Comment: | Added a flag for fastpath so that errors can be found while using it |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | wip-fix-io-layer |
Files: | files | file ages | folders |
SHA1: |
8b2b046ff52e726019a66add72650063 |
User & Date: | rkeene on 2016-12-11 23:57:25 |
Other Links: | branch diff | manifest | tags |
Context
2016-12-12
| ||
01:13 | Updated debugging printf() calls to write to a temporary buffer so that multiple calls are not mixed up when writing check-in: 4c6adaabfc user: rkeene tags: wip-fix-io-layer | |
2016-12-11
| ||
23:57 | Added a flag for fastpath so that errors can be found while using it check-in: 8b2b046ff5 user: rkeene tags: wip-fix-io-layer | |
21:22 | Rewrote state engine for OpenSSL connection establishment to be more easily reasoned about check-in: 77e904c4e2 user: rkeene tags: wip-fix-io-layer | |
Changes
Modified tlsBIO.c from [f1da770d9f] to [62db7198c2].
︙ | |||
67 68 69 70 71 72 73 | 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. */ |
︙ | |||
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 | 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; |
︙ | |||
143 144 145 146 147 148 149 | 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; |
︙ | |||
195 196 197 198 199 200 201 | 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; |
︙ |
Modified tlsIO.c from [320c969bcc] to [b04673cb79].
︙ | |||
418 419 420 421 422 423 424 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | - + | * NULL to get all options and * their values. */ Tcl_DString *dsPtr) /* Where to store the computed value * initialized by caller. */ { State *statePtr = (State *) instanceData; |
︙ | |||
473 474 475 476 477 478 479 | 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 | - + | if (statePtr->flags & TLS_TCL_CALLBACK) { dprintf("Callback is on-going, doing nothing"); return; } dprintFlags(statePtr); |
︙ | |||
538 539 540 541 542 543 544 | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | - - + - - - - + - + - + - - - - | * The appropriate Tcl_File or NULL if not present. * * Side effects: * None. * *------------------------------------------------------------------- */ |
︙ | |||
883 884 885 886 887 888 889 | 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 | - + + + + + + | } } *errorCodePtr = 0; return(0); } |
Modified tlsInt.h from [5bf94ee7f7] to [75b3699ce0].
︙ | |||
86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | + | fprintf(stderr, "%s:%i:%s():%s->flags=0", __FILE__, __LINE__, __func__, #statePtr); \ if (((statePtr)->flags & TLS_TCL_ASYNC) == TLS_TCL_ASYNC) { fprintf(stderr,"|TLS_TCL_ASYNC"); }; \ if (((statePtr)->flags & TLS_TCL_SERVER) == TLS_TCL_SERVER) { fprintf(stderr,"|TLS_TCL_SERVER"); }; \ if (((statePtr)->flags & TLS_TCL_INIT) == TLS_TCL_INIT) { fprintf(stderr,"|TLS_TCL_INIT"); }; \ if (((statePtr)->flags & TLS_TCL_DEBUG) == TLS_TCL_DEBUG) { fprintf(stderr,"|TLS_TCL_DEBUG"); }; \ if (((statePtr)->flags & TLS_TCL_CALLBACK) == TLS_TCL_CALLBACK) { fprintf(stderr,"|TLS_TCL_CALLBACK"); }; \ if (((statePtr)->flags & TLS_TCL_HANDSHAKE_FAILED) == TLS_TCL_HANDSHAKE_FAILED) { fprintf(stderr,"|TLS_TCL_HANDSHAKE_FAILED"); }; \ if (((statePtr)->flags & TLS_TCL_FASTPATH) == TLS_TCL_FASTPATH) { fprintf(stderr,"|TLS_TCL_FASTPATH"); }; \ fprintf(stderr, "\n"); \ } #else #define dprintf(...) if (0) { fprintf(stderr, __VA_ARGS__); } #define dprintBuffer(bufferName, bufferLength) /**/ #define dprintFlags(statePtr) /**/ #endif |
︙ | |||
112 113 114 115 116 117 118 | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - + | #define TLS_TCL_INIT (1<<2) /* Initializing connection */ #define TLS_TCL_DEBUG (1<<3) /* Show debug tracing */ #define TLS_TCL_CALLBACK (1<<4) /* In a callback, prevent update * looping problem. [Bug 1652380] */ #define TLS_TCL_HANDSHAKE_FAILED (1<<5) /* Set on handshake failures and once * set, all further I/O will result * in ECONNABORTED errors. */ |
︙ | |||
152 153 154 155 156 157 158 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - + | #endif /* Tcl_GetStackedChannel */ #endif /* USE_TCL_STUBS */ /* * Forward declarations */ Tcl_ChannelType *Tls_ChannelType(void); |