-
- if (amsender) {
- double elapsed_want= now * stream_allow_secsperbyte;
- double elapsed= mgettime_elapsed(ts_last, &ts_last);
- double needwait= elapsed_want - elapsed;
- if (needwait > 1) needwait= 1;
- if (needwait > 0) usleep(ceil(needwait * 1e6));
- }
-
- r= fread(mainbuf,1,now,sf); if (r!=now) sdie(sf,sxi);
- r= fwrite(mainbuf,1,now,df); if (r!=now) ddie(df,dxi);
- l -= now;
- done += now;