Add a close method, fix a memory leak
git-svn-id: file:///home/svn/framework3/trunk@9056 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
71ba477674
commit
197595839a
|
@ -61,6 +61,10 @@ class Client < ::XMLRPC::Client
|
||||||
super(meth, *args)
|
super(meth, *args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def close
|
||||||
|
self.sock.close
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,6 +50,7 @@ class Service < ::XMLRPC::BasicServer
|
||||||
|
|
||||||
def on_client_connect(c)
|
def on_client_connect(c)
|
||||||
self.state[c] = ""
|
self.state[c] = ""
|
||||||
|
self.clean_state_table
|
||||||
end
|
end
|
||||||
|
|
||||||
def on_client_data(c)
|
def on_client_data(c)
|
||||||
|
@ -62,6 +63,12 @@ class Service < ::XMLRPC::BasicServer
|
||||||
procxml(c)
|
procxml(c)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def clean_state_table
|
||||||
|
self.state.keys.each do |s|
|
||||||
|
self.state.delete(s) if s.closed?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def procxml(c)
|
def procxml(c)
|
||||||
while(self.state[c].index("\x00"))
|
while(self.state[c].index("\x00"))
|
||||||
mesg,left = self.state[c].split("\x00", 2)
|
mesg,left = self.state[c].split("\x00", 2)
|
||||||
|
|
Loading…
Reference in New Issue