Use `with-actor-nonblocking-ports' in irc.scm.
authorChristopher Allan Webber <cwebber@dustycloud.org>
Mon, 31 Jul 2017 22:31:28 +0000 (17:31 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 3 Aug 2017 20:50:19 +0000 (15:50 -0500)
* 8sync/systems/irc.scm (irc-bot-main-loop): Use
`with-actor-nonblocking-ports'.

8sync/systems/irc.scm

index 030f2d3b8b68b4e7c19f778d529478d4357bdef9..404d1f4641506da35bab58aefbfcd080591433f4 100755 (executable)
 (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?)