thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthieu Imbert <matthieu.imb...@ens-lyon.fr>
Subject Re: per-connexion state with txthrift
Date Thu, 11 Feb 2010 21:50:48 GMT
Esteve Fernandez wrote:
> 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

Hi Esteve,

It seems to be a half-working solution since I don't see how i can then access this data from
the thrift handler (which is shared by all incoming client connexions).

For example, how could i access this protocol.connection_id from one of the thrift function
handler of the MyHandler instance, in my previous example?

cheers,

-- 
Matthieu

Mime
View raw message