The sptps_receive_data() was changed in commit
d237efd to only process
one SPTPS record from a stream input. So now we have to put a loop
around it to ensure we process everything.
}
static void receive_data(sptps_t *sptps) {
- char buf[4096];
+ char buf[4096], *bufp = buf;
int fd = *(int *)sptps->handle;
size_t len = recv(fd, buf, sizeof buf, 0);
- if(!sptps_receive_data(sptps, buf, len))
- abort();
+ while(len) {
+ size_t done = sptps_receive_data(sptps, bufp, len);
+ if(!done)
+ abort();
+ bufp += done;
+ len -= done;
+ }
}
struct timespec start;
fprintf(stderr, "Dropped.\n");
continue;
}
- if(!sptps_receive_data(&s, buf, len) && !datagram)
- return 1;
+ char *bufp = buf;
+ while(len) {
+ size_t done = sptps_receive_data(&s, bufp, len);
+ if(!done) {
+ if(!datagram)
+ return 1;
+ } else {
+ break;
+ }
+
+ bufp += done;
+ len -= done;
+ }
}
}