Your message dated Sun, 17 Apr 2011 11:56:21 +0200
with message-id <[email protected]>
and subject line Closing 620791
has caused the Debian Bug report #620791,
regarding Add a global timeout option to ajaxterm
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
620791: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=620791
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: ajaxterm
Version: 0.10-10
Severity: normal
Tags: patch
User: [email protected]
Usertags: origin-ubuntu natty ubuntu-patch

OpenStack is being packaged for Debian. OpenStack ships a patched
ajaxterm. Naturally, we don't want to ship that in the OpenStack Debian
packages, so this is the second of two patches that we need in the
ajaxterm package to support OpenStack.

Add a -T option to terminate ajaxterm itself (different from the
existing timeout code which reaps dead connections). This ensures we
don't leave stale ajaxterm servers around.

Thanks for considering the patch.


-- System Information:
Debian Release: squeeze/sid
  APT prefers natty-updates
  APT policy: (500, 'natty-updates'), (500, 'natty-security'), (500, 'natty')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-7-generic (SMP w/2 CPU cores)
Locale: LANG=da_DK.UTF-8, LC_CTYPE=da_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru ajaxterm-0.10/debian/patches/91_terminate_on_idle.diff ajaxterm-0.10/debian/patches/91_terminate_on_idle.diff
--- ajaxterm-0.10/debian/patches/91_terminate_on_idle.diff	1970-01-01 01:00:00.000000000 +0100
+++ ajaxterm-0.10/debian/patches/91_terminate_on_idle.diff	2011-03-23 15:15:35.000000000 +0100
@@ -0,0 +1,91 @@
+Index: ajaxterm-0.10/ajaxterm.py
+===================================================================
+--- ajaxterm-0.10.orig/ajaxterm.py	2011-03-23 15:13:53.861429744 +0100
++++ ajaxterm-0.10/ajaxterm.py	2011-03-23 15:15:27.491567073 +0100
+@@ -29,6 +29,8 @@
+ from socket import gethostname
+ 
+ 
++global g_server
++
+ def debug(str):
+ 	now = datetime.datetime.now()
+ 	print "%s - %s" % (now.isoformat(), str)
+@@ -395,7 +397,7 @@
+ class Multiplex:
+ 	INACTIVE_PROCESS_TIMEOUT=120    # I guess this is the IP max packet lifetime
+ 
+-	def __init__(self,cmd=None,serverport=None):
++	def __init__(self,cmd=None,serverport=None,term_on_idle=0):
+ 		signal.signal(signal.SIGCHLD, signal.SIG_IGN)
+ 		self.cmd=cmd
+ 		self.serverport=serverport
+@@ -403,6 +405,8 @@
+ 		self.lock=threading.RLock()
+ 		self.thread=threading.Thread(target=self.loop)
+ 		self.alive=1
++ 		self.term_on_idle = term_on_idle
++		self.lastActivity=time.time()
+ 		# synchronize methods
+ 		for name in ['create','fds','proc_read','proc_write','dump','die','run']:
+ 			orig=getattr(self,name)
+@@ -493,6 +497,9 @@
+ 		while self.run():
+ 			fds=self.fds()
+ 			i,o,e=select.select(fds, [], [], 1.0)
++			if self.term_on_idle and time.time() - self.lastActivity > self.term_on_idle:
++				global g_server
++				g_server.shutdown()
+ 			for fd in i:
+ 				self.proc_read(fd)
+ 			if len(i):
+@@ -505,7 +512,7 @@
+ 				pass
+ 
+ class AjaxTerm:
+-	def __init__(self,cmd=None,index_file='ajaxterm.html',serverport=None,token=None):
++	def __init__(self,cmd=None,index_file='ajaxterm.html',serverport=None,token=None,term_on_idle=0):
+ 		self.files={}
+ 		self.token=token
+ 		for i in ['css','html','js']:
+@@ -514,7 +521,7 @@
+ 		self.files['index']=file(index_file).read()
+ 		self.mime = mimetypes.types_map.copy()
+ 		self.mime['.html']= 'text/html; charset=UTF-8'
+-		self.multi = Multiplex(cmd,serverport)
++		self.multi = Multiplex(cmd,serverport,term_on_idle)
+ 		self.reaper = Reaper(self.multi)
+ 		self.session = {}
+ 		self.session_ip = {}
+@@ -565,6 +572,7 @@
+ 			if k:
+ 				self.multi.proc_write(term,k)
+ 			time.sleep(0.002)
++			self.multi.lastActivity = time.time()
+ 			dump=self.multi.dump(term,c)
+ 			if isinstance(dump,str):
+ 				req.write(dump)
+@@ -611,6 +619,7 @@
+ 	parser.add_option("-u", "--uid", dest="uid", help="Set the daemon's user id")
+ 	parser.add_option("-s", "--serverport", dest="serverport", help="Use a different port than 22 to connect to the ssh server")
+ 	parser.add_option("-t", "--token", dest="token", help="Set authorization token")
++	parser.add_option("-T", "--terminate-on-idle", metavar="SEC", action="store", type="int", dest="term_on_idle", help="Terminate if idle for more than SEC seconds (0 means never)")
+ 	(o, a) = parser.parse_args()
+ 	if o.daemon:
+ 		pid=os.fork()
+@@ -636,11 +645,13 @@
+ 			sys.exit(0)
+ 	else:
+ 		print 'AjaxTerm at http://localhost:%s/' % o.port
+-	at=AjaxTerm(o.cmd,o.index_file,o.serverport,o.token)
++	at=AjaxTerm(o.cmd,o.index_file,o.serverport,o.token,o.term_on_idle)
+ #	f=lambda:os.system('firefox http://localhost:%s/&;'%o.port)
+ #	qweb.qweb_wsgi_autorun(at,ip='localhost',port=int(o.port),threaded=0,log=o.log,callback_ready=None)
+ 	try:
+-		qweb.QWebWSGIServer(at,ip='localhost',port=int(o.port),threaded=1,log=o.log).serve_forever()
++		global g_server
++		g_server = qweb.QWebWSGIServer(at,ip='localhost',port=int(o.port),threaded=1,log=o.log)
++		g_server.serve_forever()
+ 	except KeyboardInterrupt,e:
+ 		sys.excepthook(*sys.exc_info())
+ 	at.multi.die()
diff -Nru ajaxterm-0.10/debian/patches/series ajaxterm-0.10/debian/patches/series
--- ajaxterm-0.10/debian/patches/series	2011-02-13 21:32:58.000000000 +0100
+++ ajaxterm-0.10/debian/patches/series	2011-03-23 14:02:30.000000000 +0100
@@ -13,3 +13,4 @@
 35_fix-sarissa.diff
 40_more-ctrl-catches.diff
 90_token_based_access_control.diff
+91_terminate_on_idle.diff

--- End Message ---
--- Begin Message ---
Package: ajaxterm
Version: 0.10-11

Closing this bug - typo in the changelog entry of ajaxterm 0.10-11

Julien

-- 
  .''`.   Julien Valroff ~ <[email protected]> ~ <[email protected]>    
 : :'  :  Debian Developer & Free software contributor
 `. `'`   http://www.kirya.net/
   `-     4096R/ E1D8 5796 8214 4687 E416  948C 859F EF67 258E 26B1



--- End Message ---

Reply via email to