chiark / gitweb /
cope if client of current command dies
authorian <ian>
Sun, 8 Jun 2008 00:18:38 +0000 (00:18 +0000)
committerian <ian>
Sun, 8 Jun 2008 00:18:38 +0000 (00:18 +0000)
hostside/multiplex

index 06078254c35335d998921654091f92be669cbf42..9415dd193d4a250273afa2c78307458307a6bee8 100755 (executable)
@@ -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 }