From: ian Date: Sun, 8 Jun 2008 00:18:38 +0000 (+0000) Subject: cope if client of current command dies X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=e26dbd289a6700d4e07cf6b1c346832d85719437;p=trains.git cope if client of current command dies --- diff --git a/hostside/multiplex b/hostside/multiplex index 0607825..9415dd1 100755 --- a/hostside/multiplex +++ b/hostside/multiplex @@ -82,7 +82,9 @@ proc xmit-relevantly {m} { if {$executing} { puts "<* $m" set myconn $currentconn - trapping xmit-only-noreport $currentconn +$m + if {[string length $currentconn]} { + trapping xmit-only-noreport $currentconn +$m + } set othersm -$m } else { puts "<& $m" @@ -371,9 +373,12 @@ proc xmit-only {conn msg} { #---------- error handling ---------- proc kill-conn {conn msg} { - global conns queueing + global conns queueing currentconn upvar #0 c/$conn c catch { unset conns($conn) } ;# do this first to stop any recursion + if {[info exists currentconn]} { + if {![string compare $currentconn $conn]} { set currentconn {} } + } puts "<$conn\$ closing : $msg" if {[string length $msg]} { catch { xmit-only-always $conn "$msg" } } catch { close $conn }