From 39469a161ea198b675075967cda847c1ed99c434 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Mon, 31 Jul 2017 17:31:28 -0500 Subject: [PATCH] Use `with-actor-nonblocking-ports' in irc.scm. * 8sync/systems/irc.scm (irc-bot-main-loop): Use `with-actor-nonblocking-ports'. --- 8sync/systems/irc.scm | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/8sync/systems/irc.scm b/8sync/systems/irc.scm index 030f2d3..404d1f4 100755 --- a/8sync/systems/irc.scm +++ b/8sync/systems/irc.scm @@ -194,18 +194,20 @@ (define (irc-bot-main-loop irc-bot message) (define socket (irc-bot-socket irc-bot)) (define line (string-trim-right (read-line socket) #\return)) - (dispatch-raw-line irc-bot line) - (cond - ;; The port's been closed for some reason, so stop looping - ((port-closed? socket) - 'done) - ;; We've reached the EOF object, which means we should close - ;; the port ourselves and stop looping - ((eof-object? (peek-char socket)) - (close socket) - 'done) - (else - (<- (actor-id irc-bot) 'main-loop)))) + (with-actor-nonblocking-ports + (lambda () + (dispatch-raw-line irc-bot line) + (cond + ;; The port's been closed for some reason, so stop looping + ((port-closed? socket) + 'done) + ;; We've reached the EOF object, which means we should close + ;; the port ourselves and stop looping + ((eof-object? (peek-char socket)) + (close socket) + 'done) + (else + (<- (actor-id irc-bot) 'main-loop)))))) (define* (irc-bot-send-line-action irc-bot message channel line #:key emote?) -- 2.31.1