Place for initialization / deinitialization code in ecap adapter

Asked by Lucian Bazoi on 2011-02-01

Hi
    Where should I place the initialization and uninitialization code in ecap adapter v0.1.0 ?

This is what happens now
 squid -NC
dying from an unhandled exception: file not found
terminate called after throwing an instance of 'TextException'
  what(): file not found

Thank you.

Question information

Language:
English Edit question
Status:
Answered
For:
eCAP Edit question
Assignee:
No assignee Edit question
Last query:
2011-02-02
Last reply:
2011-02-02
Alex Rousskov (rousskov) said : #1

There are several options here. The simplest initialization/deinitialization places would be the adapter Service constructor and destructor, I guess. If you need to have access to configuration info, then use configure() and reconfigure() methods of your adapter Service class.

Lucian Bazoi (dezvoltator) said : #2

I added constructor and destructor in Adapter::Service and put the initialization code in constructor but the constructor doesn't seem to get called. I put a debug stream and wrote to it in constructor but the output is not seen in log.

Lucian Bazoi (dezvoltator) said : #3

what I write in Adapter::Service::configure in debug stream doesn't appear in log.

Alex Rousskov (rousskov) said : #4

A Service constructor must be called for the Service object to exist. If you want to prove that it is being called, put an abort() call there.

As for debugging, I believe it may work during Service construction, but it does not have to because the Service object and the host application may not have registered with each other yet. See libecap's src/libecap/common/registry.{cc,h} for details.

Debugging in configure calls should work in principle, but the host application may not be able to debug during configuration. For example, during configuration, Squid can only debug at level zero (ilCritical in libecap).

Can you help with this problem?

Provide an answer of your own, or ask Lucian Bazoi for more information if necessary.

To post a message you must log in.