shithub: irc.myr

Download patch

ref: 1c5ea0812da9db76c6a1bfd5eca326459181ec83
parent: 924ccee8b60d0f0aff1b5d3b859abaa3d4dc6759
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Oct 17 10:07:48 EDT 2019

Fix death logic.

--- a/main.myr
+++ b/main.myr
@@ -65,9 +65,9 @@
 	var pingtime, droptime
 
 	for s : irc.srv
-		droptime = s.death == 0 ? 0 : std.now() - s.death 
+		droptime = std.now() - s.death 
 		pingtime = std.now() - s.ping
-		if droptime >= 60*std.Sec
+		if s.death != 0 && droptime >= 60*std.Sec
 			status(irc, irc.self, "{}: connection dropped\n", s.ds)
 		elif pingtime >= 300*std.Sec
 			status(irc, irc.self, "{}: ping timed out\n", s.ds)
@@ -78,9 +78,9 @@
 		s.fd = -1
 		match std.dial(s.ds)
 		| `std.Ok fd:
+			s.death = 0
 			s.fd = fd
 			handshake(irc, s)
-			s.death = std.now()
 			for c : irc.onconn
 				do(irc, c)
 				redraw(irc)
--