If you are using the C++ bindings, then you want to implement your own 
'IfFactory'.  For a service named 'Foo', the thrift compiler will make a 
C++ interface name 'FooIfFactory'.  It also generates a class inheriting 
from FooIfFactory named 'FooIfSingletonFactory'. 

FooIfFactory looks something like this:
class FooIfFactory {
 public:
  typedef FooIf Handler;

  virtual ~FooIfFactory() {}

  virtual FooIf* getHandler(const ::apache::thrift::TConnectionInfo& 
connInfo) = 0;
  virtual void releaseHandler(FooIf* /* handler */) = 0;
};

connInfo has pointers to the respective Transport classes, and you can 
dynamic_cast to get to the TSocket, and eventually to the IP.



From:   Stuart Reynolds <s...@stureynolds.com>
To:     user@thrift.apache.org, 
Date:   06/02/2015 11:34 AM
Subject:        Re: client connect event
Sent by:        stuart.reyno...@gmail.com



Subclassing is an easy way to inject missing functionality.  Override
methods that perform your own logic and call the superclass's version
of the method.
TSocket / TTransport are probably the right places to add this.

On Tue, Jun 2, 2015 at 2:19 AM, Rene Winkler Sørensen <re...@vestas.com>

wrote:
> My team is building a client/server application using thrift over 
rpc/tcp, we have one requirement from our stakeholder that we find very 
complicated in thrift. Every time a client opens a connection, we need to 
log the IP of that connection, it does not matter if the client calls 
anything, the log have to be there. So my question is, how do I do that, 
as far as I can see, the options are very limited. I found an event called

TServerEventHandler, but I don't get the right information there as I see 
it, can anyone point me in the right direction if there is one??
>
>
> Yours sincerely / Med venlig hilsen
>
>
> René Winkler Sørensen
> Software Development Engineer
> Product Development, Service Engineering
> Technology & Service Solutions (TSS)
>
>
> Vestas Wind Systems A/S
> T: 83 11 39 97
> M: +45 2245 5971
> re...@vestas.com<mailto:re...@vestas.com>
>
> Vestas Wind Systems A/S
> This e-mail is subject to out e-mail disclaimer statement.
> Please refer to http://www.vestas.com/legal/notice
> If you have received this e-mail in error please contact the sender.
>

Reply via email to