From 64074ffb24384958638b6fa2b4e8f5784e7ffb49 Mon Sep 17 00:00:00 2001 From: Sergey Dorofeev Date: Sun, 5 Feb 2012 23:18:21 +0400 Subject: [PATCH] disable NR in NETSPOOL mode due to fatal incompatibility --- CHANGES.fidoman | 2 ++ source/bforce/prot_binkp.c | 4 ++++ source/bforce/prot_binkp_misc.c | 9 +++++++-- source/bforce/prot_common.c | 29 ++++++++++++++++++----------- 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/CHANGES.fidoman b/CHANGES.fidoman index 5af1697..ef27328 100644 --- a/CHANGES.fidoman +++ b/CHANGES.fidoman @@ -1,6 +1,8 @@ === 2012-02 === Netspool support +Netspool forcibly disables NR mode in binkp +(due to NR mode requires access to file on local filesystem) === 2011-12-25 === diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index f687a63..274cffe 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -363,7 +363,9 @@ int binkp_incoming(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data) override_get (&ovr, remote_data->addrs[i].addr, 0); if (!nodelist_checkflag (ovr.sFlags, "NR")) { +#ifndef NETSPOOL szOpt = xstrcat (szOpt, " NR"); +#endif break; } } @@ -439,6 +441,7 @@ int binkp_transfer(s_protinfo *pi) { if (remote->options & BINKP_OPT_NR) { binkp_queuemsgf(&bpi,BPMSG_FILE,"%s %ld %ld -1",name,total,time); binkp_send_state = BPT_Wait_M_GET; + log("binkp going to BPT_Wait_M_GET"); } else { binkp_queuemsgf(&bpi,BPMSG_FILE,"%s %ld %ld 0", name,total,time); binkp_send_state = BPT_Send_File; @@ -446,6 +449,7 @@ int binkp_transfer(s_protinfo *pi) { } } if (binkp_send_state == BPT_Send_File) { + log("binkp BPT_Send_File"); if (bpi.opos == 0 && bpi.n_msgs == 0) { if((n = p_tx_readfile (bpi.obuf+BINKP_BLK_HDRSIZE,4096,pi))<0) { p_tx_fclose (pi); diff --git a/source/bforce/prot_binkp_misc.c b/source/bforce/prot_binkp_misc.c index b84bf63..8321f86 100644 --- a/source/bforce/prot_binkp_misc.c +++ b/source/bforce/prot_binkp_misc.c @@ -538,8 +538,10 @@ void binkp_queue_sysinfo(s_bpinfo *bpi, s_binkp_sysinfo *binkp) if (state.caller) { char *szOpt = xstrcpy (" MB"); +#ifndef NETSPOOL if (!nodelist_checkflag (state.node.flags, "NR")) szOpt = xstrcat (szOpt, " NR"); +#endif if (!nodelist_checkflag (state.node.flags, "ND")) szOpt = xstrcat (szOpt, " ND"); if (*szOpt) @@ -732,9 +734,12 @@ void binkp_parse_options(s_binkp_sysinfo *binkp, char *options) for( p = string_token(options, &n, NULL, 0); p; p = string_token(NULL, &n, NULL, 0) ) { - if( !strcmp(p, "NR") ) +#ifndef NETSPOOL + if( !strcmp(p, "NR") ) { binkp->options |= BINKP_OPT_NR; - else if( !strcmp(p, "MB") ) + } else +#endif + if( !strcmp(p, "MB") ) binkp->options |= BINKP_OPT_MB; else if( !strcmp(p, "MPWD") ) binkp->options |= BINKP_OPT_MPWD; diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index e1daeb6..21273bb 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -102,9 +102,9 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) /* network queue */ #ifdef NETSPOOL - log("start netspool"); + log("netspool next file"); if(state.netspool.state == NS_NOTINIT) { - log("netspool connection"); + log("new netspool connection"); char password[100]; char address[300]; char *host = conf_string(cf_netspool_host); @@ -135,7 +135,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) log("netspool begin receive"); netspool_receive(&state.netspool); } else { - log("netspool is busy"); + log("netspool could not start receive"); return 1; } @@ -144,11 +144,14 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) *dest = NULL; return 0; } - + + if(state.netspool.state == NS_READY) { + log("no files to receive"); + netspool_end(&state.netspool); + } + if(state.netspool.state==NS_ERROR) { - log("netspool error %s", state.netspool.error); - } else { - log("netspool gives no more files"); + log("no next file: netspool error %s", state.netspool.error); } #endif @@ -452,6 +455,7 @@ int p_tx_fclose(s_protinfo *pi) break; #ifdef NETSPOOL case ACTION_ACKNOWLEDGE: + log("netspool commit %s", state.netspool.filename); netspool_acknowledge(&state.netspool); break; #endif @@ -482,6 +486,7 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) #ifdef NETSPOOL if(pi->send->fname==NULL && strcmp(pi->send->local_name, "NETSPOOL")==0 ) { + log("reading netspool file"); if( state.netspool.state != NS_RECVFILE ) { log("send: wrong netspool state"); pi->send->status = FSTAT_SKIPPED; @@ -490,12 +495,14 @@ int p_tx_readfile(char *buffer, size_t buflen, s_protinfo *pi) n = netspool_read(&state.netspool, buffer, buflen); pi->send->eofseen = state.netspool.length == 0; if( n==-1 ) { - log("send: netspool error"); - log(state.netspool.error); + log("send: netspool error %s", state.netspool.error); pi->send->status = FSTAT_SKIPPED; return -2; } + log("got %d bytes from netspool", n); return n; + } else { + log("reading local file"); } #endif /* @@ -1295,9 +1302,9 @@ void p_session_cleanup(s_protinfo *pi, bool success) #ifdef NETSPOOL if(state.netspool.state==NS_ERROR) { - log("netspool error %s", state.netspool.error); + log("end session: netspool error %s", state.netspool.error); } - netspool_end(&state.netspool); + /*netspool_end(&state.netspool);*/ #endif }