From: patthoyts Date: Sat, 5 Jul 2008 20:41:44 +0000 (+0000) Subject: Applied patch 1848365 to accept any boolean value for the -mcastloop option (plus... X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=3210f5438caf0dcfd42b7da8b6ae5ce6b2c78a33;p=tcludp Applied patch 1848365 to accept any boolean value for the -mcastloop option (plus tests). --- diff --git a/ChangeLog b/ChangeLog index e333386..1fd4ab6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-07-05 Pat Thoyts + + * generic/udp_tcl.c: Applied patch 1848365 to accept any boolean + value for the -mcastloop option (plus tests). + 2007-04-10 Pat Thoyts * generic/udp_tcl.c: Applied patch 1693037 from Uwe Klein to diff --git a/generic/udp_tcl.c b/generic/udp_tcl.c index 3f19787..4719097 100644 --- a/generic/udp_tcl.c +++ b/generic/udp_tcl.c @@ -1430,7 +1430,7 @@ udpSetOption(ClientData instanceData, Tcl_Interp *interp, } else if (!strcmp("-mcastloop", optionName)) { int tmp = 1; - r = Tcl_GetInt(interp, newValue, &tmp); + r = Tcl_GetBoolean(interp, newValue, &tmp); if (r == TCL_OK) { unsigned char ctmp = (unsigned char)tmp; if (setsockopt(statePtr->sock, IPPROTO_IP, IP_MULTICAST_LOOP, @@ -1475,6 +1475,7 @@ ErrorToObj(const char * prefix) #ifdef WIN32 LPVOID sMsg; DWORD len = 0; + len = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, diff --git a/tests/udp-srv.test b/tests/udp-srv.test index 6079cb2..1a3615a 100644 --- a/tests/udp-srv.test +++ b/tests/udp-srv.test @@ -8,10 +8,10 @@ if {[catch { package require udp -# Some tests are marked as slow as they can take 30s to test a volume of packets. -# We generally just test for correctness and these do not significantly contribute -# in testing correctness. -::tcltest::testConstraint slow 1 +# Some tests are marked as slow as they can take 30s to test a volume +# of packets. We generally just test for correctness and these do not +# significantly contribute in testing correctness. +::tcltest::testConstraint slow 0 # Enable printing timing information during some tests. ::tcltest::testConstraint timestamp 1 diff --git a/tests/udp.test b/tests/udp.test index 14318b4..6b81945 100644 --- a/tests/udp.test +++ b/tests/udp.test @@ -94,6 +94,24 @@ test udp-2.2 {udp_open on named port} {pcOnly} { } msg] $msg } {0 0x007b} +test udp-3.8 {multicastloop can be set to true} \ + -body { + set s [udp_open] + fconfigure $s -mcastloop "true" + fconfigure $s -mcastloop + } -result {1} -cleanup { + close $s + } + +test udp-3.9 {multicastloop can be set to false} \ + -body { + set s [udp_open] + fconfigure $s -mcastloop "true" + fconfigure $s -mcastloop "no" + fconfigure $s -mcastloop + } -result {0} -cleanup { + close $s + } # ------------------------------------------------------------------------- # cleanup