@@ -438,11 +438,11 @@ WaitForConnect(
438
438
/*
439
439
* Check if an async connect is running. If not return ok
440
440
*/
441
-
441
+
442
442
if (!(statePtr -> flags & TCP_ASYNC_PENDING )) {
443
443
return 0 ;
444
444
}
445
-
445
+
446
446
if (errorCodePtr == NULL || (statePtr -> flags & TCP_NONBLOCKING )) {
447
447
timeout = 0 ;
448
448
} else {
@@ -601,7 +601,7 @@ TcpCloseProc(
601
601
* handlers are already deleted in the generic IO channel closing code
602
602
* that called this function, so we do not have to delete them here.
603
603
*/
604
-
604
+
605
605
for (fds = & statePtr -> fds ; fds != NULL ; fds = fds -> next ) {
606
606
if (fds -> fd < 0 ) {
607
607
continue ;
@@ -610,7 +610,7 @@ TcpCloseProc(
610
610
if (close (fds -> fd ) < 0 ) {
611
611
errorCode = errno ;
612
612
}
613
-
613
+
614
614
}
615
615
fds = statePtr -> fds .next ;
616
616
while (fds != NULL ) {
@@ -974,7 +974,7 @@ TcpWatchProc(
974
974
*/
975
975
return ;
976
976
}
977
-
977
+
978
978
if (statePtr -> flags & TCP_ASYNC_PENDING ) {
979
979
/* Async sockets use a FileHandler internally while connecting, so we
980
980
* need to cache this request until the connection has succeeded. */
@@ -1111,7 +1111,7 @@ TcpConnect(
1111
1111
for (statePtr -> myaddr = statePtr -> myaddrlist ; statePtr -> myaddr != NULL ;
1112
1112
statePtr -> myaddr = statePtr -> myaddr -> ai_next ) {
1113
1113
int reuseaddr = 1 ;
1114
-
1114
+
1115
1115
/*
1116
1116
* No need to try combinations of local and remote addresses of
1117
1117
* different families.
@@ -1141,15 +1141,15 @@ TcpConnect(
1141
1141
* Set the close-on-exec flag so that the socket will not get
1142
1142
* inherited by child processes.
1143
1143
*/
1144
-
1144
+
1145
1145
fcntl (statePtr -> fds .fd , F_SETFD , FD_CLOEXEC );
1146
-
1146
+
1147
1147
/*
1148
1148
* Set kernel space buffering
1149
1149
*/
1150
-
1150
+
1151
1151
TclSockMinimumBuffers (INT2PTR (statePtr -> fds .fd ), SOCKET_BUFSIZE );
1152
-
1152
+
1153
1153
if (async ) {
1154
1154
ret = TclUnixSetBlockingMode (statePtr -> fds .fd ,TCL_MODE_NONBLOCKING );
1155
1155
if (ret < 0 ) {
@@ -1160,7 +1160,7 @@ TcpConnect(
1160
1160
/* Gotta reset the error variable here, before we use it for the
1161
1161
* first time in this iteration. */
1162
1162
error = 0 ;
1163
-
1163
+
1164
1164
(void ) setsockopt (statePtr -> fds .fd , SOL_SOCKET , SO_REUSEADDR ,
1165
1165
(char * ) & reuseaddr , sizeof (reuseaddr ));
1166
1166
ret = bind (statePtr -> fds .fd , statePtr -> myaddr -> ai_addr ,
@@ -1176,7 +1176,7 @@ TcpConnect(
1176
1176
* will set up a file handler on the socket if she is interested
1177
1177
* in being informed when the connect completes.
1178
1178
*/
1179
-
1179
+
1180
1180
ret = connect (statePtr -> fds .fd , statePtr -> addr -> ai_addr ,
1181
1181
statePtr -> addr -> ai_addrlen );
1182
1182
if (ret < 0 ) error = errno ;
@@ -1459,28 +1459,28 @@ Tcl_OpenTcpServer(
1459
1459
}
1460
1460
continue ;
1461
1461
}
1462
-
1462
+
1463
1463
/*
1464
1464
* Set the close-on-exec flag so that the socket will not get
1465
1465
* inherited by child processes.
1466
1466
*/
1467
-
1467
+
1468
1468
fcntl (sock , F_SETFD , FD_CLOEXEC );
1469
-
1469
+
1470
1470
/*
1471
1471
* Set kernel space buffering
1472
1472
*/
1473
-
1473
+
1474
1474
TclSockMinimumBuffers (INT2PTR (sock ), SOCKET_BUFSIZE );
1475
-
1475
+
1476
1476
/*
1477
1477
* Set up to reuse server addresses automatically and bind to the
1478
1478
* specified port.
1479
1479
*/
1480
-
1481
- (void ) setsockopt (sock , SOL_SOCKET , SO_REUSEADDR ,
1480
+
1481
+ (void ) setsockopt (sock , SOL_SOCKET , SO_REUSEADDR ,
1482
1482
(char * ) & reuseaddr , sizeof (reuseaddr ));
1483
-
1483
+
1484
1484
/*
1485
1485
* Make sure we use the same port number when opening two server
1486
1486
* sockets for IPv4 and IPv6 on a random port.
@@ -1509,7 +1509,7 @@ Tcl_OpenTcpServer(
1509
1509
if (howfar < BIND ) {
1510
1510
howfar = BIND ;
1511
1511
my_errno = errno ;
1512
- }
1512
+ }
1513
1513
close (sock );
1514
1514
sock = -1 ;
1515
1515
continue ;
@@ -1541,7 +1541,7 @@ Tcl_OpenTcpServer(
1541
1541
/*
1542
1542
* Allocate a new TcpState for this socket.
1543
1543
*/
1544
-
1544
+
1545
1545
statePtr = ckalloc (sizeof (TcpState ));
1546
1546
memset (statePtr , 0 , sizeof (TcpState ));
1547
1547
statePtr -> acceptProc = acceptProc ;
@@ -1556,12 +1556,12 @@ Tcl_OpenTcpServer(
1556
1556
newfds -> fd = sock ;
1557
1557
newfds -> statePtr = statePtr ;
1558
1558
fds = newfds ;
1559
-
1559
+
1560
1560
/*
1561
1561
* Set up the callback mechanism for accepting connections from new
1562
1562
* clients.
1563
1563
*/
1564
-
1564
+
1565
1565
Tcl_CreateFileHandler (sock , TCL_READABLE , TcpAccept , fds );
1566
1566
}
1567
1567
@@ -1620,7 +1620,7 @@ TcpAccept(
1620
1620
socklen_t len ; /* For accept interface */
1621
1621
char channelName [SOCK_CHAN_LENGTH ];
1622
1622
char host [NI_MAXHOST ], port [NI_MAXSERV ];
1623
-
1623
+
1624
1624
len = sizeof (addr );
1625
1625
newsock = accept (fds -> fd , & addr .sa , & len );
1626
1626
if (newsock < 0 ) {
0 commit comments