Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch rmax-ipv6-branch Through [16c719352e] Excluding Merge-Ins
This is equivalent to a diff from 188a795873 to 16c719352e
|
2011-06-06
| ||
| 15:07 | * Don't use port 0 for test 14.2 as it fails in different ways on Linux and NetBSD. * Unify ch... check-in: b563eaed64 user: max tags: rmax-ipv6-branch | |
|
2011-06-01
| ||
| 15:30 | * Improve socket.test by checking the latency on the loopback address and use that for some of th... check-in: 16c719352e user: max tags: rmax-ipv6-branch | |
|
2011-05-31
| ||
| 20:36 | Fix bug 3293874 check-in: 09c2da3a2a user: dgp tags: trunk | |
| 19:58 | Rewind from a refactoring that veered into the weeds. Closed-Leaf check-in: 1d247886db user: dgp tags: bug-3293874 | |
|
2011-05-30
| ||
| 18:04 | * Fix setting up of [fileevent] while an async socket is still in progress * Cache async sock... check-in: 6d66913621 user: max tags: rmax-ipv6-branch | |
|
2011-05-27
| ||
| 18:36 | Fix [socket -async] for DNS names with more than one address check-in: a1abfd5e94 user: max tags: rmax-ipv6-branch | |
| 17:50 | fix a timing issue in socket-12.3 check-in: 188a795873 user: max tags: trunk | |
|
2011-05-25
| ||
| 14:37 | committed missing tzdata/Africa/Cairo from venkat's last commit check-in: df2425d65c user: kbk tags: trunk | |
Changes to ChangeLog.
|
Changes to tests/socket.test.
| ︙ | |||
66 67 68 69 70 71 72 73 74 75 76 77 78 79 | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | + + + + + + + + + + + + + + + + + |
# Some tests require the testthread and exec commands
testConstraint testthread [llength [info commands testthread]]
testConstraint exec [llength [info commands exec]]
# Produce a random port number in the Dynamic/Private range
# from 49152 through 65535.
proc randport {} { expr {int(rand()*16383+49152)} }
# Test the latency of tcp connections over the loopback interface. Some OSes
# (e.g. NetBSD) seem to use the Nagle algorithm and delayed ACKs, so it takes
# up to 200ms for a packet sent to localhost to arrive. We're measuring this
# here, so that OSes that don't have this problem can
set server [socket -server {apply {{s a p} {set ::s1 $s}}} 0]
set s2 [socket localhost [lindex [fconfigure $server -sockname] 2]]
vwait s1; close $server
fconfigure $s1 -buffering line
fconfigure $s2 -buffering line
set t1 [clock milliseconds]
puts $s2 test1; gets $s1
puts $s2 test2; gets $s1
close $s1; close $s2
set t2 [clock milliseconds]
set latency [expr {$t2-$t1}]
unset t1 t2 s1 s2 server
# If remoteServerIP or remoteServerPort are not set, check in the environment
# variables for externally set values.
#
if {![info exists remoteServerIP]} {
if {[info exists env(remoteServerIP)]} {
|
| ︙ | |||
580 581 582 583 584 585 586 | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | - + |
vwait x
fconfigure $sock -blocking 0
set result a:[gets $sock]
lappend result b:[gets $sock]
fconfigure $sock -blocking 1
puts $s2 two
flush $s2
|
| ︙ | |||
1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 | 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
# cleanup
if {$remoteProcChan ne ""} {
catch {sendCommand exit}
}
catch {close $commandSocket}
catch {close $remoteProcChan}
}
unset ::tcl::unsupported::socketAF
test socket-14.0 {[socket -async] when server only listens on one address family} \
-constraints [list socket supported_any] \
-setup {
proc accept {s a p} {
global x
puts $s bye
close $s
set x ok
}
set server [socket -server accept -myaddr 127.0.0.1 0]
set port [lindex [fconfigure $server -sockname] 2]
} -body {
set client [socket -async localhost $port]
set after [after 1000 {set x [fconfigure $client -error]}]
vwait x
set x
} -cleanup {
after cancel $after
close $server
close $client
unset x
} -result ok
test socket-14.1 {[socket -async] fileevent while still connecting} \
-constraints [list socket supported_any] \
-setup {
proc accept {s a p} {
global x
puts $s bye
close $s
lappend x ok
}
set server [socket -server accept -myaddr 127.0.0.1 0]
set port [lindex [fconfigure $server -sockname] 2]
} -body {
set client [socket -async localhost $port]
fileevent $client writable {
lappend x [expr {[fconfigure $client -error] eq ""}]
}
set after [after 1000 {set x timeout}]
vwait x
vwait x
set x
} -cleanup {
after cancel $after
close $server
close $client
unset x
} -result {ok 1}
test socket-14.2 {[socket -async] fileevent connection refused} \
-constraints [list socket supported_any] \
-body {
set client [socket -async localhost 0]
fileevent $client writable {set x [fconfigure $client -error]}
set after [after 1000 {set x timeout}]
vwait x
set x
} -cleanup {
after cancel $after
close $client
unset x
} -result "connection refused"
::tcltest::cleanupTests
flush stdout
return
# Local Variables:
# mode: tcl
# fill-column: 78
# End:
|
Changes to unix/tclUnixSock.c.
| ︙ | |||
45 46 47 48 49 50 51 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | + + + - + - + + + + + + + + + + + + + + + + |
} TcpFdList;
struct TcpState {
Tcl_Channel channel; /* Channel associated with this file. */
TcpFdList *fds; /* The file descriptors of the sockets. */
int flags; /* ORed combination of the bitfields defined
* below. */
union {
struct {
/* Only needed for server sockets */
|
| ︙ | |||
85 86 87 88 89 90 91 | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | - - + + - | #define SOCKET_BUFSIZE 4096 /* * Static routines for this file: */ |
| ︙ | |||
628 629 630 631 632 633 634 | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | + - - - - - + + + + + + + + + |
}
if ((len > 1) && (optionName[1] == 'e') &&
(strncmp(optionName, "-error", len) == 0)) {
socklen_t optlen = sizeof(int);
int err, ret;
if (statePtr->status == 0) {
|
| ︙ | |||
781 782 783 784 785 786 787 | 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | - - - - - - - - - + + + + + + + + + + + - |
TcpWatchProc(
ClientData instanceData, /* The socket state. */
int mask) /* Events of interest; an OR-ed combination of
* TCL_READABLE, TCL_WRITABLE and
* TCL_EXCEPTION. */
{
TcpState *statePtr = (TcpState *) instanceData;
|
| ︙ | |||
824 825 826 827 828 829 830 831 832 833 834 | 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | + + + + + + + + + + - + - + - + - - + + - + - + - - - - - - - + + - + - - - - - + - - - + + - - - + + + - - - - + + + + - + + + + + + + + + + - - + + - + - + - + - + - + + - + - + + - + - + - - + - - - - - - - - + + + + + + + + + + + + + + - - - - - + - - - - - + + + - - - - - + - - - + + - - - - - + + + + + - + + + - + + + + - - - + + + - - - + - - - - - - - + + + + + + + + - - - - - - - - - - - + |
ClientData *handlePtr) /* Where to store the handle. */
{
TcpState *statePtr = (TcpState *) instanceData;
*handlePtr = INT2PTR(statePtr->fds->fd);
return TCL_OK;
}
static void
TcpAsyncCallback(
ClientData clientData, /* The socket state. */
int mask) /* Events of interest; an OR-ed combination of
* TCL_READABLE, TCL_WRITABLE and
* TCL_EXCEPTION. */
{
CreateClientSocket(NULL, clientData);
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | |||
1019 1020 1021 1022 1023 1024 1025 | 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 | - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - + - - - - + - - - + + + - + - + + + + + + + + + + + |
const char *host, /* Host on which to open port. */
const char *myaddr, /* Client-side address */
int myport, /* Client-side port */
int async) /* If nonzero, attempt to do an asynchronous
* connect. Otherwise we do a blocking
* connect. */
{
|
| ︙ | |||
1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | + - - |
int mode) /* ORed combination of TCL_READABLE and
* TCL_WRITABLE to indicate file mode. */
{
TcpState *statePtr;
char channelName[16 + TCL_INTEGER_SPACE];
statePtr = ckalloc(sizeof(TcpState));
memset(statePtr, 0, sizeof(TcpState));
statePtr->fds = ckalloc(sizeof(TcpFdList));
memset(statePtr->fds, (int) 0, sizeof(TcpFdList));
statePtr->fds->fd = PTR2INT(sock);
statePtr->flags = 0;
|
| ︙ | |||
1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | + |
memset(newfds, (int) 0, sizeof(TcpFdList));
if (statePtr == NULL) {
/*
* Allocate a new TcpState for this socket.
*/
statePtr = ckalloc(sizeof(TcpState));
memset(statePtr, 0, sizeof(TcpState));
statePtr->fds = newfds;
statePtr->acceptProc = acceptProc;
statePtr->acceptProcData = acceptProcData;
sprintf(channelName, "sock%d", sock);
} else {
fds->next = newfds;
}
|
| ︙ | |||
1319 1320 1321 1322 1323 1324 1325 | 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 | - + - - |
* Set close-on-exec flag to prevent the newly accepted socket from being
* inherited by child processes.
*/
(void) fcntl(newsock, F_SETFD, FD_CLOEXEC);
newSockState = ckalloc(sizeof(TcpState));
|
| ︙ |