aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--c/irc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/c/irc.c b/c/irc.c
index 551dca1..250738a 100644
--- a/c/irc.c
+++ b/c/irc.c
@@ -399,16 +399,22 @@ void main(void) {
for (;;) {
n = net_recv_nb(sock, seg, (unsigned char)sizeof(seg));
if (n == 0) { say("-!- disconnected"); break; }
- if (n != 0xFE && n != 0xFF) { /* got a segment: drain hard */
- feed(seg, n);
- idle = 0;
- continue;
- }
+ if (n != 0xFE && n != 0xFF) feed(seg, n); /* render a segment if any */
if (quitting) { say("-!- quit"); break; }
+
+ /* Poll input EVERY pass, even mid-flood: otherwise a big MOTD (or a
+ * busy channel) starves the keyboard for its whole duration - the OSK
+ * won't even open, and keystrokes are dropped. That's what made
+ * '/join #sl0p right after connect' look broken. */
i = pollin(); /* OSK */
if (!i) i = pollcon(); /* hub-injected console bytes */
- if (i) { key(i); idle = 0; continue; }
- if (++idle >= 4) { msleep(20); idle = 4; } /* settle when idle */
+ if (i) key(i);
+
+ if (n == 0xFE || n == 0xFF) { /* nothing received this pass */
+ if (!i && ++idle >= 4) { msleep(20); idle = 4; }
+ } else {
+ idle = 0; /* actively receiving; don't sleep */
+ }
}
net_close(sock);
row_clear();