thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Esteve Fernandez" <>
Subject Re: per-connexion state with txthrift
Date Thu, 11 Feb 2010 17:21:56 GMT
Hi Matthieu

> Is there a way to maintain some per-connexion state with a python twisted
> thrift server?

if I understood it correctly, this would suffice:

class MyThriftServerFactory(ThriftServerFactory):

    def buildProtocol(self, addr):
        p = self.protocol()
        p.factory = self

        # add something to the protocol instance
        # e.g. a unique id
        import uuid
        p.connection_id = uuid.uuid4()

        return p

then use MyThriftServerFactory as you'd normally use ThriftServerFactory


View raw message