Slight speed improvement to request processing

git-svn-id: file:///home/svn/framework3/trunk@10599 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-10-08 06:14:44 +00:00
parent 41183d3395
commit d8b9cf5cac
1 changed files with 11 additions and 7 deletions

View File

@ -24,15 +24,19 @@ class Client < ::XMLRPC::Client
# This override hooks into the RPCXML library
def do_rpc(request,async)
self.sock.put(request + "\x00")
while(not @buff.index("\x00"))
resp = self.sock.get
if ( (!resp or resp == "") and @buff.index("\x00").nil?)
raise RuntimeError, "XMLRPC connection closed: #{resp.inspect}"
begin
while(not @buff.index("\x00"))
if ::IO.select([self.sock], nil, nil, 30)
resp = self.sock.sysread(32768)
@buff << resp if resp
end
end
@buff << resp if resp
rescue ::Exception => e
self.sock.close rescue nil
raise EOFError, "XMLRPC connection closed"
end
mesg,left = @buff.split("\x00", 2)