acs::Cluster method reachable (protected)

 <instance of acs::Cluster[i]> reachable location

Defined in packages/acs-tcl/tcl/cluster-procs.tcl

:log "reachable $location"

Parameters:
location (required)

Testcases:
No testcase defined.
Source code:
set d [ns_parseurl $location]
#ns_log notice "reachable: $location -> $d"
set result 0
dict with d {
    switch $proto {
        "udp" {
            #
            # assume, udp is always reachable
            #
            set result 1
        }
        "http" -
        "https" {
            #
            # We can check via ns_connchan
            #
            try {
                #ns_logctl severity Debug(connchan) on
                ns_connchan connect $host $port
            } on error {} {
                #
                # Not reachable, stick with the default 0
                #
            } on ok {chan} {
                set result 1
                ns_connchan close $chan
            }
        }
    }
}
:log "node $location is reachable: $result"  "last_contact [:last_contact $location]"  "last_request [:last_request $location]"
if {$result} {
    nsv_set cluster $location-last-contact [clock clicks -milliseconds]
}
return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: