thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom F <>
Subject Accessing the transport inside a Twisted Service handler
Date Fri, 22 Nov 2013 15:19:46 GMT
I have a Thrift service running with Python and Twisted. The IP address
that they are using to connect to the service is needed within the handler
and I can't find an elegant way to access it.

Currently I am over-riding the ThriftServerProtocol.stringReceived()
function (
with a copy, but changing line 127 from:

d = self.factory.processor.process(iprot, oprot)


processor = TheService.Processor(TheServiceHandler(self.transport.getHost()))

d = processor.process(iprot, oprot)

This does work fine, but it has the overhead of having to create a new
processor and handler for each call the client makes. I can add
caching so that only one needs to be created per client, but its still
fairly hacky and likely to break with future changes.

Is there a better way to achieve this? It must be a fairly common use case.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message