chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #920: irc: reconnecting due to server-side EOF broken


From: Chicken Trac
Subject: [Chicken-janitors] #920: irc: reconnecting due to server-side EOF broken
Date: Sun, 09 Sep 2012 00:19:03 -0000

#920: irc: reconnecting due to server-side EOF broken
---------------------+------------------------------------------------------
 Reporter:  michael  |       Owner:       
     Type:  defect   |      Status:  new  
 Priority:  major    |   Milestone:       
Component:  unknown  |     Version:  4.8.x
 Keywords:           |  
---------------------+------------------------------------------------------
 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 ;-).

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/920>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]