diff options
| author | user <user@clank> | 2026-07-17 23:20:55 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-07-17 23:20:55 +0200 |
| commit | 15b4767b17f78a827fd221e941c7ac7aa987e02f (patch) | |
| tree | d9f7a414a1b9dd3d88bc940c60538c2f977423ff /c/irc.c | |
| parent | irc: strip mIRC formatting, drop 004/005 noise, fix a RAM-bank-swap landmine (diff) | |
| download | gbos-15b4767b17f78a827fd221e941c7ac7aa987e02f.tar.gz gbos-15b4767b17f78a827fd221e941c7ac7aa987e02f.tar.xz gbos-15b4767b17f78a827fd221e941c7ac7aa987e02f.zip | |
irc: keep the keyboard live during RX floods (poll input every pass)
'/join #sl0p right after connect' looked broken: the main loop only
polled input when net_recv_nb returned nothing, and 'continue'd on every
received segment. During a big MOTD (irc.sl0p.foo's is ~60 lines of
color art) that starved input for the whole ~20s flood - the OSK
wouldn't even open, and keystrokes were dropped. gbtype input fared a
bit better (buffered in the 64-byte console ring) but still wasn't
serviced until the flood ended.
Poll pollin()/pollcon() once every loop iteration regardless of RX, and
only idle-sleep when a pass both received nothing and read no key. The
protocol/join logic was already correct (verified: JOIN #sl0p is sent,
accepted, and the client switches to [#sl0p] with topic + names) - this
just makes typing responsive while messages are streaming.
Verified against the live server: injecting /join #sl0p *during* the
MOTD flood now joins immediately instead of waiting it out.
(Note: '#' is on the OSK - third row, second from the end:
10,8,":;,=+*_!?()[]<>@#~" - just not obvious.)
Diffstat (limited to '')
| -rw-r--r-- | c/irc.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -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(); |
