Unified · Split
| @@ -42,7 +42,7 @@ struct C9aux { · 41 unmodified lines | ||
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | 44 | static const char *nick; |
| 45 | −static int printjoin, startlen; | |
| 45 | +static int printjoin, startlen, inflight; | |
| 46 | 46 | static uint64_t chatoff, skipuntil; |
| 47 | 47 | static char start[256]; |
| 48 | 48 | |
| @@ -176,6 +176,7 @@ ctxchatR(C9ctx *ctx, C9r *r) · 127 unmodified lines | ||
| 176 | 176 | break; |
| 177 | 177 | |
| 178 | 178 | case Rread: |
| 179 | + inflight--; | |
| 179 | 180 | if (chatoff == 0 && skipuntil > 0 && memcmp(start, r->read.data, MIN((int)r->read.size, startlen)) != 0) { |
| 180 | 181 | skipuntil = 0; |
| 181 | 182 | startlen = 0; |
| @@ -196,11 +197,12 @@ ctxchatR(C9ctx *ctx, C9r *r) · 14 unmodified lines | ||
| 196 | 197 | } |
| 197 | 198 | /* gotta read fast */ |
| 198 | 199 | n = chatoff; |
| 199 | − for (i = 0; i < 4; i++) { | |
| 200 | + for (i = 0; i < 4-inflight; i++) { | |
| 200 | 201 | sz = n < skipuntil ? skipuntil-n : Msize; |
| 201 | 202 | c9read(ctx, &tag, Chatfid, n, sz); |
| 202 | 203 | n += sz; |
| 203 | 204 | } |
| 205 | + inflight = 4; | |
| 204 | 206 | break; |
| 205 | 207 | |
| 206 | 208 | case Rerror: |