Check-in [b07aac060d]
Overview
Comment:Cache local address for a long time, it is not likely to change
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b07aac060de5fc04295a9799a2f762d6a8956e5ad22b2ce8e2a8a385264dedc2
User & Date: rkeene on 2019-01-23 05:40:03
Other Links: manifest | tags
Context
2019-01-23
05:43
Ensure random implementations are static check-in: f1e737d284 user: rkeene tags: trunk
05:40
Cache local address for a long time, it is not likely to change check-in: b07aac060d user: rkeene tags: trunk
05:29
Removed debugging code check-in: 6d73b93560 user: rkeene tags: trunk
Changes

Modified nano.tcl from [3378d4d0fc] to [36ea6c846f].

2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463

proc ::nano::network::_localIP {version} {
	set now [clock seconds]

	if {[info exists ::nano::network::_localIP($version)]} {
		set cached $::nano::network::_localIP($version)
		set lastCheckTime [dict get $cached lastCheckTime]
		if {($lastCheckTime + 300) >= $now} {
			if {[dict exists $cached value]} {
				return [dict get $cached value]
			} else {
				return -code error "Unable to resolve address for IP $version (cached)"
			}
		}
	}







|







2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463

proc ::nano::network::_localIP {version} {
	set now [clock seconds]

	if {[info exists ::nano::network::_localIP($version)]} {
		set cached $::nano::network::_localIP($version)
		set lastCheckTime [dict get $cached lastCheckTime]
		if {[clock add $lastCheckTime 1 day] >= $now} {
			if {[dict exists $cached value]} {
				return [dict get $cached value]
			} else {
				return -code error "Unable to resolve address for IP $version (cached)"
			}
		}
	}