|
|
@ -106,7 +106,7 @@ int binkp_loop(s_binkp_state *bstate) {
|
|
|
|
bool no_more_to_send = false;
|
|
|
|
bool no_more_to_send = false;
|
|
|
|
bool no_more_read = false;
|
|
|
|
bool no_more_read = false;
|
|
|
|
bool canread, canwrite;
|
|
|
|
bool canread, canwrite;
|
|
|
|
|
|
|
|
|
|
|
|
int timeout = conf_number(cf_binkp_timeout);
|
|
|
|
int timeout = conf_number(cf_binkp_timeout);
|
|
|
|
if( timeout==0 )
|
|
|
|
if( timeout==0 )
|
|
|
|
timeout = 60;
|
|
|
|
timeout = 60;
|
|
|
@ -117,12 +117,13 @@ int binkp_loop(s_binkp_state *bstate) {
|
|
|
|
|
|
|
|
|
|
|
|
// session criterium handshake criterium
|
|
|
|
// session criterium handshake criterium
|
|
|
|
while (!bstate->complete || bstate->waiting_got) {
|
|
|
|
while (!bstate->complete || bstate->waiting_got) {
|
|
|
|
DEB((D_24554, "loop s: %d r: %d p: %d sp: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete,
|
|
|
|
DEB((D_24554, ">>> BinkP loop sendcpl: %d recvcpl: %d phase: %d subphase: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete,
|
|
|
|
bstate->phase, bstate->subphase));
|
|
|
|
bstate->phase, bstate->subphase));
|
|
|
|
if (bstate->continuesend) {
|
|
|
|
if (bstate->continuesend) {
|
|
|
|
no_more_to_send = false;
|
|
|
|
no_more_to_send = false;
|
|
|
|
bstate->continuesend = false;
|
|
|
|
bstate->continuesend = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) {
|
|
|
|
if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) {
|
|
|
|
m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length);
|
|
|
|
m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length);
|
|
|
|
if(m==1 || m==3) {
|
|
|
|
if(m==1 || m==3) {
|
|
|
@ -267,6 +268,7 @@ int binkp_loop(s_binkp_state *bstate) {
|
|
|
|
have_to_write -= n;
|
|
|
|
have_to_write -= n;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DEB((D_24554,"+++ BinkP Loop ended with rc=%d", bstate->rc));
|
|
|
|
return bstate->rc;
|
|
|
|
return bstate->rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -339,7 +341,7 @@ int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned
|
|
|
|
int my_sf, wr_pos;
|
|
|
|
int my_sf, wr_pos;
|
|
|
|
int n; // read file
|
|
|
|
int n; // read file
|
|
|
|
if (bstate->extracmd[0]!=-1) {
|
|
|
|
if (bstate->extracmd[0]!=-1) {
|
|
|
|
DEB((D_24554, "send command from receiver %d %s", bstate->extracmd[0], bstate->extracmd+1));
|
|
|
|
DEB((D_24554, "Send cmd to remote %d %s", bstate->extracmd[0], bstate->extracmd+1));
|
|
|
|
buf[0] = bstate->extracmd[0];
|
|
|
|
buf[0] = bstate->extracmd[0];
|
|
|
|
strcpy(buf+1, bstate->extracmd+1);
|
|
|
|
strcpy(buf+1, bstate->extracmd+1);
|
|
|
|
*block_type = BINKP_BLK_CMD;
|
|
|
|
*block_type = BINKP_BLK_CMD;
|
|
|
@ -625,7 +627,7 @@ case 4:
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
case 5:
|
|
|
|
DEB((D_24554, "nothing to send"));
|
|
|
|
DEB((D_24554, "BinkP_GetForSend: nothing to send"));
|
|
|
|
return 2;
|
|
|
|
return 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -804,7 +806,7 @@ case 0:
|
|
|
|
bstate->frs = frs_data;
|
|
|
|
bstate->frs = frs_data;
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DEB((D_24554, "making M_GET to skip downloaded part"));
|
|
|
|
DEB((D_24554, "making M_GET to skip downloaded part, file: %s, size %ld, time %ld, mode 0",recvfi.fn,recvfi.sz, recvfi.tm ));
|
|
|
|
bstate->extracmd[0] = BPMSG_GET;
|
|
|
|
bstate->extracmd[0] = BPMSG_GET;
|
|
|
|
sprintf(bstate->extracmd+1, "%s %ld %ld %ld",
|
|
|
|
sprintf(bstate->extracmd+1, "%s %ld %ld %ld",
|
|
|
|
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
|
|
|
|
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,
|
|
|
|