Article delegate-en/4937 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[Reference:<_A4933@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: FTP/SFTP Gateway - connection refused
24 Nov 2010 12:01:15 GMT Vijay Pandit <pyejabdyi-hugik5q6sjxr.ml@ml.delegate.org>


Hi Yutaka,

I rebuilt delegate using the enclosed patch and tested, but there is no
change.

When the timeouts occur, the sftp process does not start when the ftp client
issues a CWD.

I have attached the log file with the -vd option enabled.

The test I did was for the ftp client to log into delegate, issue the CWD to
connect to the SFTP server and then quit command. Sessions that froze
after the CWD command, had in the the log:

--rdy=0 alv=1 (1.000)
---- SFTPCC Alive? [22] rdy=0 rcc=0 alv=1 []
-SFTPGW:connect_serv REAL_PROTO=sftp ->FS

Cheers

Vijay Pandit



On Thu, Nov 11, 2010 at 7:57 PM, Yutaka Sato <feedback@delegate.org> wrote:

> Hi,
>
> In message <_A4932@delegate-en.ML_>
> on 11/10/10(15:39:11)
> you Vijay Pandit <pyejabdyi-hugik5q6sjxr.ml@ml.delegate.org> wrote:
>  |I updated to 9.9.8-pre18, however the timeouts still occur.
>  |It may be something to do with the connection cache
>
> I see. Thank you.
> With the enclosed patch, a broken cached session will be abandoned
> and a new session will be retried.  Also you can shorten the timeout
> of session caching as follows:
>
>  TIMEOUT=cc:10 ## shorten the timeout for session cache (180 sec. by
> default)
>
> Cheers,
> Yutaka
> --
>  9 9   Yutaka Sato, CSDP,ITIL-F <y.sato@delegate.org>
> http://delegate.org/y.sato/
>  ( ~ )  National Institute of Advanced Industrial Science and Technology
> _<   >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan
> Do the more with the less -- B. Fuller
>
>
> diff -cr dist/src/delegate9.9.8-pre18/src/env.c ./src/env.c
> *** dist/src/delegate9.9.8-pre18/src/env.c      Sat Oct  9 22:55:07 2010
> --- ./src/env.c Thu Nov 11 17:40:24 2010
> ***************
> *** 636,641 ****
> --- 636,642 ----
>  extern int CON_TIMEOUT;
>  extern int LIN_TIMEOUT;
>  extern int IO_TIMEOUT;
> + extern int CC_TIMEOUT;
>  extern int CC_TIMEOUT_FTP;
>  extern int CC_TIMEOUT_NNTP;
>  extern int CACHE_TAKEOVER;
> ***************
> *** 705,710 ****
> --- 706,712 ----
>                if( streq(name,"takeover"))  iaddr = &CACHE_TAKEOVER; else
>                if( streq(name,"ftpcc"))     iaddr = &CC_TIMEOUT_FTP; else
>                if( streq(name,"nntpcc"))    iaddr = &CC_TIMEOUT_NNTP; else
> +               if( streq(name,"cc") )       iaddr = &CC_TIMEOUT; else
>                if( streq(name,"htmuxskew")) daddr = &MAX_HTMUXSKEW; else
>
>        if( streq(name,"http-wait-qbody"))   daddr = &HTTP_WAIT_REQBODY;
> else
> diff -cr dist/src/delegate9.9.8-pre18/src/sftp.c ./src/sftp.c
> *** dist/src/delegate9.9.8-pre18/src/sftp.c     Sun Jun 13 21:03:52 2010
> --- ./src/sftp.c        Thu Nov 11 17:44:18 2010
> ***************
> *** 867,872 ****
> --- 867,878 ----
>                        }
>                        gw = CC_accept("sftp",host,port,user,fileno(fs));
>                        if( 0 <= gw ){
> +                               putsftp(ts,"cd .","");
> +
> relay_resp(fs,-1,0,AVStr(sresp),"restart",1);
> +                               if( sresp[0] == 0 ){
> +                                       sv1log("##sftp_CC NotAlive\n");
> +                                       break;
> +                               }
>                                fc = fdopen(gw,"r");
>                                fpv[0] = fc;
>                                tc = fdopen(gw,"w");
> ***************
> *** 1245,1256 ****
> --- 1251,1290 ----
>        /* should salvage CC-socket ... */
>        _Finish(0);
>  }
> + int sftpIsAlive(int fd){
> +       double St = Time();
> +       int rdy;
> +       int rcc;
> +       IStr(buf,128);
> +       refQStr(bp,buf);
> +
> +       rdy = PollIn(fd,1000);
> +       sv1log("--rdy=%d alv=%d (%.3f)\n",rdy,IsAlive(fd),Time()-St);
> +       if( 0 < rdy ){
> +               rcc = recvPeekTIMEOUT(fd,AVStr(buf),sizeof(buf)-1);
> +               if( 0 < rcc ){
> +                       setVStrEnd(buf,rcc);
> +                       if( bp = strchr(buf,'\n') )
> +                               clearVStr(bp);
> +               }
> +       }
> +       sv1log("---- SFTPCC Alive? [%d] rdy=%d rcc=%d alv=%d [%s]\n",
> +               fd,rdy,rcc,IsAlive(fd),0<rcc?buf:"");
> +
> +       if( 0 < IsAlive(fd) ){
> +               return 1;
> +       }
> +       return 0;
> + }
>  int connectToSftp(const char *host,int port,const char *user,int fdc,int
> fdv[]){
>        int socks[2];
>
>        socks[1] = CC_connect("sftp",host,port,user);
>        if( 0 <= socks[1] ){
>                DEBUG("---- SFTPCC HIT[%d] %s@
> %s:%d\n",socks[1],user,host,port);
> +               if( !sftpIsAlive(socks[1]) ){
> +                       close(socks[1]);
> +               }else
>                return socks[1];
>        }
>        DEBUG("---- SFTPCC MISS %s@%s:%d\n",user,host,port);
>


  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V