Check-in [d25ae3c232]
Overview
Comment:Updated to support optionally enabling/disabling a faster path for talking to the underlying channel
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wip-fix-io-layer
Files: files | file ages | folders
SHA1: d25ae3c23284afa1f3dd1ee6107619f89066cd2d
User & Date: rkeene on 2016-12-11 19:20:15
Other Links: branch diff | manifest | tags
Context
2016-12-11
20:05
Fixed pass-through to fetch file descriptor using a pointer check-in: b5ba86f2be user: rkeene tags: wip-fix-io-layer
19:20
Updated to support optionally enabling/disabling a faster path for talking to the underlying channel check-in: d25ae3c232 user: rkeene tags: wip-fix-io-layer
19:12
Corrected extraneous format specifier check-in: ff4801f473 user: rkeene tags: wip-fix-io-layer
Changes
111
112
113
114
115
116
117












118
119
120
121
122
123
124
fi

dnl Find "xxd" so we can build the tls.tcl.h file
AC_CHECK_PROG([XXD], [xxd], [xxd], [__xxd__not__found])

dnl Find "pkg-config" since we need to use it
AC_CHECK_TOOL([PKGCONFIG], [pkg-config], [false])













dnl Determine if we have been asked to statically link to the SSL library
TCLEXT_TLS_STATIC_SSL='no'
AC_ARG_ENABLE([static-ssl], AS_HELP_STRING([--enable-static-ssl], [enable statically linking to the specified SSL library]), [
	if test "$enableval" = 'yes'; then
		TCLEXT_TLS_STATIC_SSL='yes'
	fi







>
>
>
>
>
>
>
>
>
>
>
>







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
fi

dnl Find "xxd" so we can build the tls.tcl.h file
AC_CHECK_PROG([XXD], [xxd], [xxd], [__xxd__not__found])

dnl Find "pkg-config" since we need to use it
AC_CHECK_TOOL([PKGCONFIG], [pkg-config], [false])

dnl Determine if we have been asked to use a fast path if possible
tcltls_ssl_fastpath='yes'
AC_ARG_ENABLE([ssl-fastpath], AS_HELP_STRING([--disable-ssl-fast-path], [disable using the underlying file descriptor for talking directly to the SSL library]), [
	if test "$enableval" = 'no'; then
		tcltls_ssl_fastpath='no'
	fi
])

if test "$tcltls_ssl_fastpath" = 'yes'; then
	AC_DEFINE(TCLTLS_SSL_USE_FASTPATH, [1], [Define this to enable using the underlying file descriptor for talking directly to the SSL library])
fi

dnl Determine if we have been asked to statically link to the SSL library
TCLEXT_TLS_STATIC_SSL='no'
AC_ARG_ENABLE([static-ssl], AS_HELP_STRING([--enable-static-ssl], [enable statically linking to the specified SSL library]), [
	if test "$enableval" = 'yes'; then
		TCLEXT_TLS_STATIC_SSL='yes'
	fi
Modified tlsBIO.c from [e135f89793] to [f8c02fc8c8].
61
62
63
64
65
66
67

68
69
70
71
72
73
74

	if (statePtr == NULL) {
		dprintf("Asked to setup a NULL state, just creating the initial configuration");

		return(NULL);
	}


	/*
	 * 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);
	parentChannelType = Tcl_GetChannelType(parentChannel);








>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

	if (statePtr == NULL) {
		dprintf("Asked to setup a NULL state, just creating the initial configuration");

		return(NULL);
	}

#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);
	parentChannelType = Tcl_GetChannelType(parentChannel);

89
90
91
92
93
94
95


96
97


98
99
100
101
102
103
104
105
106
107
108
109
			}
		}
	}

	if (validParentChannelFd) {
		dprintf("We found a shortcut, this channel is backed by a file descriptor: %i", parentChannelFdIn);
		bio = BIO_new_socket(parentChannelFd, flags);


	} else {
		dprintf("Falling back to Tcl I/O for this channel");


		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;







>
>
|
|
>
>
|
|
|
|
<







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
			}
		}
	}

	if (validParentChannelFd) {
		dprintf("We found a shortcut, this channel is backed by a file descriptor: %i", parentChannelFdIn);
		bio = BIO_new_socket(parentChannelFd, flags);
		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;