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

Cheers.

Reply via email to