Skip to content
Snippets Groups Projects
Commit a0cb5772 authored by John Hodge's avatar John Hodge
Browse files

Merge branch 'c-agents' of git.ucc.asn.au:progcomp10 into c-agents

parents f23a69f7 eac442be
No related merge requests found
......@@ -110,13 +110,30 @@ class externAgent (BaseAgent):
self.process.stdin.write ( string )
self.process.stdout.readline() # read and discard (should be "OK")
# we kill off the process here because otherwise the class doesn't get
# destroyed until the end of the iteration. This causes us to hold more
# than MAX_TOTAL_AGENTS open for a period of time, which is a bad thing.
if self.IsDead():
try:
self.process.communicate( "BYE\r\n" )
except Exception, e:
print "Error in BYE:", self, ":", e
try:
self.process.kill()
except:
None
def __del__(self):
try:
self.process.communicate( "BYE\r\n" )
except Exception, e:
print "Error in BYE:", self, ":", e
#unless we're being deleted unexpectedly, this is a no-op.
if self.process.poll() == None:
try:
self.process.communicate( "BYE\r\n" )
except Exception, e:
print "Error in BYE:", self, ":", e
try:
self.process.kill()
except:
None
\ No newline at end of file
try:
self.process.kill()
except:
None
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment