Opened 9 years ago

Closed 9 years ago

#920 closed defect (fixed)

irc: reconnecting due to server-side EOF broken

Reported by: michael Owned by:
Priority: major Milestone:
Component: unknown Version: 4.8.x
Keywords: Cc:
Estimated difficulty:

Description

With the irc egg in version 1.9.5, the reconnect handling in irc:wait is broken:

When I use /kill testuser on the server, the connection gets shut down by the server and (read-input con) returns an EOF object.

However, irc:wait does not check for an EOF object, it only uses condition-case to catch an irc/eof error. This is useless, because (read-input con) doesn’t signal an EOF error, it merely returns an EOF object.

Therefore, irc:wait will pass this EOF object to parse-reply, which does check for EOF objects and calls (eof-error con). Since that is outside of the condition-case, this error aborts the program flow instead of triggering the reconnect behavior.

Here is a naive fix for the problem:

(define (irc:wait con)
  (unless (irc:connection-connected? con)
    (error "not connected" con) )
  (parse-reply
   (let loop ()
     (condition-case
       (let ((line (read-input con)))
        (when (eof-object? line)
          (eof-error con))
        line)
       (ex (exn net timeout)
           ;(print "\n*** timeout - reconnecting")
           (cond ((irc:connection-reconnect? con)
                  (irc:reconnect con)
                  (loop))
                 (else (abort ex))))
       (ex (irc/eof)
           (print "\n*** EOF - reconnecting")
           (cond ((irc:connection-reconnect? con)
                  (irc:reconnect con)
                  (loop))
                 (else (abort ex))))))
   con))

PS: Forgive me if my terminology is wrong. I’m still new ;-).

Change History (1)

comment:1 Changed 9 years ago by felix winkelmann

Resolution: fixed
Status: newclosed

Thanks for this fix, Michael. I have applied it and tagged irc 1.9.6.

Note: See TracTickets for help on using tickets.