##// END OF EJS Templates
chg: just take it as EOF if recv() returns 0...
Yuya Nishihara -
r29719:acf27be5 default
parent child Browse files
Show More
@@ -126,15 +126,10 b' static void readchannel(hgclient_t *hgc)'
126 return; /* assumes input request */
126 return; /* assumes input request */
127
127
128 size_t cursize = 0;
128 size_t cursize = 0;
129 int emptycount = 0;
130 while (cursize < hgc->ctx.datasize) {
129 while (cursize < hgc->ctx.datasize) {
131 rsize = recv(hgc->sockfd, hgc->ctx.data + cursize,
130 rsize = recv(hgc->sockfd, hgc->ctx.data + cursize,
132 hgc->ctx.datasize - cursize, 0);
131 hgc->ctx.datasize - cursize, 0);
133 /* rsize == 0 normally indicates EOF, while it's also a valid
132 if (rsize < 1)
134 * packet size for unix socket. treat it as EOF and abort if
135 * we get many empty responses in a row. */
136 emptycount = (rsize == 0 ? emptycount + 1 : 0);
137 if (rsize < 0 || emptycount > 20)
138 abortmsg("failed to read data block");
133 abortmsg("failed to read data block");
139 cursize += rsize;
134 cursize += rsize;
140 }
135 }
General Comments 0
You need to be logged in to leave comments. Login now