|
@@ -56,10 +56,17 @@
|
|
(U irc-message False EOF)))
|
|
(U irc-message False EOF)))
|
|
(define (read-from-client conn #:timeout [timeout #f])
|
|
(define (read-from-client conn #:timeout [timeout #f])
|
|
(define in-port (irc-connection-in conn))
|
|
(define in-port (irc-connection-in conn))
|
|
- (if (and timeout (not (sync/timeout timeout in-port)))
|
|
|
|
|
|
+ (: rl-evt (Evtof (U EOF String)))
|
|
|
|
+ (define rl-evt (read-line-evt in-port 'any))
|
|
|
|
+ (: line (U False EOF String))
|
|
|
|
+ (define line (if timeout
|
|
|
|
+ (sync/timeout timeout rl-evt)
|
|
|
|
+ (sync rl-evt)))
|
|
|
|
+ (if (string? line)
|
|
|
|
+ (parse-message line)
|
|
;; if the timeout was triggered
|
|
;; if the timeout was triggered
|
|
eof ;; return eof so that the caller closes teh connection
|
|
eof ;; return eof so that the caller closes teh connection
|
|
- (read-from-input-port in-port)))
|
|
|
|
|
|
+ ))
|
|
|
|
|
|
|
|
|
|
;; Given the string of an IRC message, returns an irc-message that has been parsed as far as possible,
|
|
;; Given the string of an IRC message, returns an irc-message that has been parsed as far as possible,
|