Commit 3a88bb73 authored by Amos Latteier's avatar Amos Latteier

Fixed zombie killing for HTTP channels. This should fix open socket creep on...

Fixed zombie killing for HTTP channels. This should fix open socket creep on heavily loaded servers.
parent 36c526f3
...@@ -109,6 +109,7 @@ import string ...@@ -109,6 +109,7 @@ import string
import os import os
import types import types
import thread import thread
import time
from cStringIO import StringIO from cStringIO import StringIO
from PubCore import handle from PubCore import handle
...@@ -324,6 +325,13 @@ class zhttp_channel(http_channel): ...@@ -324,6 +325,13 @@ class zhttp_channel(http_channel):
self.working=0 self.working=0
self.work() self.work()
def kill_zombies(self):
now = int (time.time())
for channel in asyncore.socket_map.keys():
if channel.__class__ == self.__class__:
if (now - channel.creation_time) > channel.zombie_timeout:
channel.close()
class zhttp_server(http_server): class zhttp_server(http_server):
"http server" "http server"
......
...@@ -109,6 +109,7 @@ import string ...@@ -109,6 +109,7 @@ import string
import os import os
import types import types
import thread import thread
import time
from cStringIO import StringIO from cStringIO import StringIO
from PubCore import handle from PubCore import handle
...@@ -324,6 +325,13 @@ class zhttp_channel(http_channel): ...@@ -324,6 +325,13 @@ class zhttp_channel(http_channel):
self.working=0 self.working=0
self.work() self.work()
def kill_zombies(self):
now = int (time.time())
for channel in asyncore.socket_map.keys():
if channel.__class__ == self.__class__:
if (now - channel.creation_time) > channel.zombie_timeout:
channel.close()
class zhttp_server(http_server): class zhttp_server(http_server):
"http server" "http server"
......
Markdown is supported
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