summaryrefslogtreecommitdiffstats
path: root/win/tclWinSock.c
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-07-17 09:53:36 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-07-17 09:53:36 (GMT)
commit57fd7d58a12e28ba76f2bafdf441d53fabf47cb0 (patch)
treead68a603d5f0099a682c9b043afd2313133dbcae /win/tclWinSock.c
parentf1bac0e8becc22f505069ad52dae904eae5e004d (diff)
downloadtcl-57fd7d58a12e28ba76f2bafdf441d53fabf47cb0.zip
tcl-57fd7d58a12e28ba76f2bafdf441d53fabf47cb0.tar.gz
tcl-57fd7d58a12e28ba76f2bafdf441d53fabf47cb0.tar.bz2
Replaced option "-unsupported1" by test command "testsocket debugflags" (thanks Donal, Donald).
Diffstat (limited to 'win/tclWinSock.c')
-rw-r--r--win/tclWinSock.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/win/tclWinSock.c b/win/tclWinSock.c
index 2703309..d6c8e3a 100644
--- a/win/tclWinSock.c
+++ b/win/tclWinSock.c
@@ -133,6 +133,8 @@ typedef struct TcpFdList {
struct TcpState {
Tcl_Channel channel; /* Channel associated with this socket. */
+ int testFlags; /* bit field for tests. Is set by testsocket
+ * test procedure */
struct TcpFdList *sockets; /* Windows SOCKET handle. */
int flags; /* Bit field comprised of the flags described
* below. */
@@ -191,7 +193,13 @@ struct TcpState {
* flag indicates that reentry is
* still pending */
#define TCP_ASYNC_FAILED (1<<5) /* An async connect finally failed */
-#define TCP_ASYNC_TEST_MODE (1<<6) /* Async testing activated
+
+/*
+ * These bits may be ORed together into the "testFlags" field of a TcpState
+ * structure.
+ */
+
+#define TCP_ASYNC_TEST_MODE (1<<0) /* Async testing activated
* Do not automatically continue connection
* process */
@@ -612,7 +620,7 @@ WaitForConnect(
* - Call by the event queue (errorCodePtr == NULL)
*/
- if ( (statePtr->flags & TCP_ASYNC_TEST_MODE)
+ if ( (statePtr->testFlags & TCP_ASYNC_TEST_MODE)
&& errorCodePtr != NULL && (statePtr->flags & TCP_NONBLOCKING)) {
*errorCodePtr = EWOULDBLOCK;
return -1;
@@ -1140,7 +1148,6 @@ TcpSetOptionProc(
const char *optionName, /* Name of the option to set. */
const char *value) /* New value for option. */
{
- TcpState *statePtr = instanceData;
#ifdef TCL_FEATURE_KEEPALIVE_NAGLE
TcpState *statePtr = instanceData;
SOCKET sock;
@@ -1160,22 +1167,6 @@ TcpSetOptionProc(
return TCL_ERROR;
}
- /*
- * Set socket test int value
- */
- if (!strcmp(optionName, "-unsupported1")) {
- int intValue;
- if (Tcl_GetInt(interp, value, &intValue) != TCL_OK) {
- return TCL_ERROR;
- }
- if (intValue & 1) {
- SET_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE);
- } else {
- CLEAR_BITS(statePtr->flags,TCP_ASYNC_TEST_MODE);
- }
- return TCL_OK;
- }
-
#ifdef TCL_FEATURE_KEEPALIVE_NAGLE
#error "TCL_FEATURE_KEEPALIVE_NAGLE not reviewed for whether to treat statePtr->sockets as single fd or list"
sock = statePtr->sockets->fd;
@@ -1288,7 +1279,7 @@ TcpGetOptionProc(
* Go one step in async connect
* If any error is thrown save it as backround error to report eventually below
*/
- if (! (statePtr->flags & TCP_ASYNC_TEST_MODE) ) {
+ if (! (statePtr->testFlags & TCP_ASYNC_TEST_MODE) ) {
WaitForConnect(statePtr, NULL);
}