History

9gc: don't do too many reads

Sigrid Haflínudóttir committed 6 years ago

Commit f7df90b1 parent e0379841 file · +4 −2Browse files

Unified · Split

9gc.c+4−2
@@ -42,7 +42,7 @@ struct C9aux { · 41 unmodified lines
4242 };
4343
4444 static const char *nick;
45−static int printjoin, startlen;
45+static int printjoin, startlen, inflight;
4646 static uint64_t chatoff, skipuntil;
4747 static char start[256];
4848
@@ -176,6 +176,7 @@ ctxchatR(C9ctx *ctx, C9r *r) · 127 unmodified lines
176176 break;
177177
178178 case Rread:
179+ inflight--;
179180 if (chatoff == 0 && skipuntil > 0 && memcmp(start, r->read.data, MIN((int)r->read.size, startlen)) != 0) {
180181 skipuntil = 0;
181182 startlen = 0;
@@ -196,11 +197,12 @@ ctxchatR(C9ctx *ctx, C9r *r) · 14 unmodified lines
196197 }
197198 /* gotta read fast */
198199 n = chatoff;
199− for (i = 0; i < 4; i++) {
200+ for (i = 0; i < 4-inflight; i++) {
200201 sz = n < skipuntil ? skipuntil-n : Msize;
201202 c9read(ctx, &tag, Chatfid, n, sz);
202203 n += sz;
203204 }
205+ inflight = 4;
204206 break;
205207
206208 case Rerror:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t