Article delegate-en/4132 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:<_A4130@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: Allowing tcprelay during a time window
14 Sep 2008 12:09:43 GMT feedback@delegate.org (Yutaka Sato)
The DeleGate Project


Hi,

In message <_A4130@delegate-en.ML_> on 09/12/08(02:26:29)
you Sunil S <peiiabdyi-re5dixtlohtr.ml@ml.delegate.org> wrote:
 |I tried to use :
 |
 |delegated -v -f -P$ListenPort ADMIN=nobody@nowhere.. MAXIMA=conpch:1 RELIABLE=$ReliableIP PERMIT=*:-T.$StartTime-$EndTime:* RES_WAIT=0 TIMEOUT=silence:5m SERVER=tcprelay://$ServerIP:$ServerPort/
 |
 |to control tcprelay.  I expected to terminate relay at $EndTime (hhmm).  However, connections established before $EndTime continue to remain connected.  Is this the way it is supposed to work?  If so, how can I get delegate to terminate existing connections at $EndTime?

Your guess on the behavior of DeleGate is very reasonable but it is
not so yet.  I think it should be implemented in future maybe in
DeleGate/10.X.  As a workaround for the time being, I made a generic
mechanism to watch the staleness of a session periodically (every 15
seconds) as the patch enclosed. Give it a try if necessary.
It will be applied to the next release and will be enabled with
the "-Etw" option.

Cheers,
Yutaka
--
  9 9   Yutaka Sato <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

*** dist/src/delegate9.8.4-pre1/src/service.c	Thu Jul 10 20:42:04 2008
--- ./src/service.c	Sun Sep 14 20:56:48 2008
***************
*** 1931,1936 ****
--- 1931,1959 ----
  void mount_nodefaults(PCStr(iproto),int on);
  
  void dynamic_config(Connection *Conn);
+ int ShutdownSocket(int sock);
+ /* Stale Session Watcher */
+ static void TSwatcher(Connection *Conn,int syin){
+ 	for(;;){
+ 		if( PollIn(syin,15*1000) )
+ 			break;
+ 		if( !service_permitted2(Conn,DFLT_PROTO,1) ){
+ 			sv1log("--TSwatcher permission turned-off\n");
+ 			ShutdownSocket(ClientSock);
+ 		}
+ 	}
+ }
+ int execServiceTSwatcher(Connection *Conn,iFUNCP svfunc){
+ 	int sy[2],tid,rcode;
+ 
+ 	Socketpair(sy);
+ 	tid = thread_fork(0,STX_tid,"TSwatcher",(IFUNCP)TSwatcher,Conn,sy[0]);
+ 	rcode = (*svfunc)(Conn,0,0,FromC,ToC,DST_PROTO,DST_HOST,DST_PORT,"");
+ 	close(sy[1]);
+ 	thread_wait(tid,15*1000);
+ 	close(sy[0]);
+ 	return rcode;
+ }
  int execSpecialist(Connection *Conn,int fromC,FILE *tc,int toS)
  {	iFUNCP client;
  	int clsock;
***************
*** 2096,2101 ****
--- 2119,2127 ----
  		waitSTLS_CL(Conn,500);
  	}
  
+ 	if( 1 /*lTSWATCHER()*/ ){ /* to be enabled with -Etw option */
+ 		rcode = execServiceTSwatcher(Conn,client);
+ 	}else
  	rcode = (*client)(Conn,0,0,FromC,ToC,DST_PROTO,DST_HOST,DST_PORT,D_SELECTOR);
  
  	/* close FFROMMD filter if exists */

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