summaryrefslogtreecommitdiffstats
path: root/unix
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 /unix
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 'unix')
-rw-r--r--unix/tclUnixSock.c67
1 files changed, 13 insertions, 54 deletions
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index cf5d7b9..fdd4287 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -52,6 +52,8 @@ typedef struct TcpFdList {
struct TcpState {
Tcl_Channel channel; /* Channel associated with this file. */
+ int testFlags; /* bit field for tests. Is set by testsocket
+ * test procedure */
TcpFdList fds; /* The file descriptors of the sockets. */
int flags; /* ORed combination of the bitfields defined
* below. */
@@ -89,7 +91,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 */
@@ -128,9 +136,6 @@ static int TcpClose2Proc(ClientData instanceData,
Tcl_Interp *interp, int flags);
static int TcpGetHandleProc(ClientData instanceData,
int direction, ClientData *handlePtr);
-static int TcpSetOptionProc(ClientData instanceData,
- Tcl_Interp *interp, const char *optionName,
- const char *value);
static int TcpGetOptionProc(ClientData instanceData,
Tcl_Interp *interp, const char *optionName,
Tcl_DString *dsPtr);
@@ -153,7 +158,7 @@ static const Tcl_ChannelType tcpChannelType = {
TcpInputProc, /* Input proc. */
TcpOutputProc, /* Output proc. */
NULL, /* Seek proc. */
- TcpSetOptionProc, /* Set option proc. */
+ NULL, /* Set option proc. */
TcpGetOptionProc, /* Get option proc. */
TcpWatchProc, /* Initialize notifier. */
TcpGetHandleProc, /* Get OS handles out of channel. */
@@ -453,11 +458,9 @@ WaitForConnect(
* (errorCodePtr != NULL && ! flags & TCP_NONBLOCKING)
*/
- if ( (statePtr->flags & TCP_ASYNC_TEST_MODE)
- && !(errorCodePtr != NULL && !(statePtr->flags & TCP_NONBLOCKING))) {
- if (errorCodePtr != NULL) {
- *errorCodePtr = EWOULDBLOCK;
- }
+ if ( (statePtr->testFlags & TCP_ASYNC_TEST_MODE)
+ && ! (errorCodePtr != NULL && ! (statePtr->flags & TCP_NONBLOCKING))) {
+ *errorCodePtr = EWOULDBLOCK;
return -1;
}
@@ -769,50 +772,6 @@ TcpHostPortList(
/*
*----------------------------------------------------------------------
*
- * TcpSetOptionProc --
- *
- * Sets Tcp channel specific options.
- *
- * Results:
- * None, unless an error happens.
- *
- * Side effects:
- * Changes attributes of the socket at the system level.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-TcpSetOptionProc(
- ClientData instanceData, /* Socket state. */
- Tcl_Interp *interp, /* For error reporting - can be NULL. */
- const char *optionName, /* Name of the option to set. */
- const char *value) /* New value for option. */
-{
- TcpState *statePtr = instanceData;
-
- /*
- * 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;
- }
-
- return Tcl_BadChannelOption(interp, optionName, "");
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TcpGetOptionProc --
*
* Computes an option value for a TCP socket based channel, or a list of