summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/server/xmlrpc.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/bitbake/lib/bb/server/xmlrpc.py b/bitbake/lib/bb/server/xmlrpc.py
index 026415efd5..d290550e9f 100644
--- a/bitbake/lib/bb/server/xmlrpc.py
+++ b/bitbake/lib/bb/server/xmlrpc.py
@@ -47,15 +47,29 @@ except ImportError:
47DEBUG = False 47DEBUG = False
48 48
49from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler 49from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
50import inspect, select 50import inspect, select, httplib
51 51
52from . import BitBakeBaseServer, BitBakeBaseServerConnection, BaseImplServer 52from . import BitBakeBaseServer, BitBakeBaseServerConnection, BaseImplServer
53 53
54class BBTransport(xmlrpclib.Transport): 54class BBTransport(xmlrpclib.Transport):
55 def __init__(self): 55 def __init__(self, timeout):
56 self.timeout = timeout
56 self.connection_token = None 57 self.connection_token = None
57 xmlrpclib.Transport.__init__(self) 58 xmlrpclib.Transport.__init__(self)
58 59
60 # Modified from default to pass timeout to HTTPConnection
61 def make_connection(self, host):
62 #return an existing connection if possible. This allows
63 #HTTP/1.1 keep-alive.
64 if self._connection and host == self._connection[0]:
65 return self._connection[1]
66
67 # create a HTTP connection object from a host descriptor
68 chost, self._extra_headers, x509 = self.get_host_info(host)
69 #store the host argument along with the connection object
70 self._connection = host, httplib.HTTPConnection(chost, timeout=self.timeout)
71 return self._connection[1]
72
59 def set_connection_token(self, token): 73 def set_connection_token(self, token):
60 self.connection_token = token 74 self.connection_token = token
61 75
@@ -64,8 +78,8 @@ class BBTransport(xmlrpclib.Transport):
64 h.putheader("Bitbake-token", self.connection_token) 78 h.putheader("Bitbake-token", self.connection_token)
65 xmlrpclib.Transport.send_content(self, h, body) 79 xmlrpclib.Transport.send_content(self, h, body)
66 80
67def _create_server(host, port): 81def _create_server(host, port, timeout = 5):
68 t = BBTransport() 82 t = BBTransport(timeout)
69 s = xmlrpclib.Server("http://%s:%d/" % (host, port), transport=t, allow_none=True) 83 s = xmlrpclib.Server("http://%s:%d/" % (host, port), transport=t, allow_none=True)
70 return s, t 84 return s, t
71 85