patch ebc8d6d2521391e4354381e0396671bb7d41852d
Author: Enrique D. Bosch <presidev@AT@gmail.com>
Date: Fri Sep 9 12:51:40 CEST 2016
* Improve/fix reconnection functionality
diff -rN -u old-idlebiff/idlebiff new-idlebiff/idlebiff
--- old-idlebiff/idlebiff 2024-11-22 15:58:27.191006678 +0100
+++ new-idlebiff/idlebiff 2024-11-22 15:58:27.199006666 +0100
@@ -212,9 +212,11 @@
proc recon con \
{
variable ::shared::ka
+ variable ::shared::idle
after cancel $ka
- close $con
+ set idle 0
+ catch { close $con }
after 3000 init
}
@@ -407,7 +409,7 @@
{
variable ::shared::idle
- set linea [ read_line $con ]
+ if [ catch { set linea [ read_line $con ] } ] return
set prim [ string range $linea 0 0 ]
if { $prim eq "+" } { set idle 1 } \
elseif { $idle == 1 } { idle_cycle $con 1 } \
@@ -441,16 +443,17 @@
if [ catch { set r [ gets $con line ] } ] \
{
recon $con
- return
+ return -code error
}
if [ regexp -lineanchor -nocase {^\*\s+bye .*$} $line ] \
{
recon $con
- return
+ return -code error
}
if { $r < 1 && [ eof $con ] } \
{
recon $con
+ return -code error
} \
else { return $line }
}