Check-in [aa6814c5e7]
Overview
Comment:Better handling of UDP sockets without a header (?!?)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aa6814c5e7373b1e41bea02c8563dd3337091938b2c15cfdbd5c43b199e21472
User & Date: rkeene on 2019-01-23 07:59:00
Other Links: manifest | tags
Context
2019-01-23
08:13
On some platforms the IPv6 address from TclUDP is enclosed in braces, strip them out check-in: 7dc146968b user: rkeene tags: trunk
07:59
Better handling of UDP sockets without a header (?!?) check-in: aa6814c5e7 user: rkeene tags: trunk
07:36
Support getaddrinfo() checks on Windows check-in: f61852edde user: rkeene tags: trunk
Changes

Modified nano.tcl from [857c216b2e] to [b556409ab5].

3717
3718
3719
3720
3721
3722
3723

3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744

3745






3746
3747
3748
3749
3750
3751
3752
		}

		# Used to just start listening
		if {$address eq "" || $port eq ""} {
			return
		}


		set protocolVersion "v[::ip::version $address]"
		set socket $::nano::node::realtime::socket($protocolVersion)
		set peerSock [list type "realtime" remote [list $address $port] socket $socket]
	} elseif {$type eq "bootstrap"} {
		set peerSock [::nano::network::_connect $address $port]
	} else {
		return -code error "Unknown network type: $type"
	}

	return $peerSock
}

proc ::nano::node::realtime::incoming {socket} {
	set data [read $socket 8192]
	if {$data eq ""} {
		return
	}

	set remote [chan configure $socket -peer]
	set address [lindex $remote 0]
	set port [lindex $remote 1]

	set peerSock [::nano::node::createSocket realtime $address $port]






	set response [::nano::network::server $data "realtime" $peerSock]
	if {$response eq ""} {
		return
	}

	set response [dict get $response "invoke_client"]








>
|




















>
|
>
>
>
>
>
>







3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
		}

		# Used to just start listening
		if {$address eq "" || $port eq ""} {
			return
		}

		set addressVersion [::ip::version $address]
		set protocolVersion "v$addressVersion"
		set socket $::nano::node::realtime::socket($protocolVersion)
		set peerSock [list type "realtime" remote [list $address $port] socket $socket]
	} elseif {$type eq "bootstrap"} {
		set peerSock [::nano::network::_connect $address $port]
	} else {
		return -code error "Unknown network type: $type"
	}

	return $peerSock
}

proc ::nano::node::realtime::incoming {socket} {
	set data [read $socket 8192]
	if {$data eq ""} {
		return
	}

	set remote [chan configure $socket -peer]
	set address [lindex $remote 0]
	set port [lindex $remote 1]
	catch {
		set peerSock [::nano::node::createSocket realtime $address $port]
	}
	if {![info exists peerSock]} {
		::nano::node::log "Error: Unable to create socket from address \"$address\" port \"$port\""
		return
	}

	set response [::nano::network::server $data "realtime" $peerSock]
	if {$response eq ""} {
		return
	}

	set response [dict get $response "invoke_client"]