Domanda

I have got this error.The code is below: I have integrated vmime libraries in my code.Now i need to implement timeout handler with specific timeout entry 30sec here, as per the requirement so implementing this part of the code.

class myTimeoutHandler : public vmime :: net :: timeoutHandler {
    public:
     bool isTimeOut()
    {
        return(getTime()>=m_last + 30);
    }
    void resetTimeOut()
    {
        m_last = getTime();
    }
     bool handleTimeOut()
    {
        logMsg(DEBUG,2,"Connection Timed Out!");
        return true;
    }
private:

 const unsigned int getTime() const

 {
    return vmime::platform::getHandler()->getUnixTime();
 }
unsigned int m_last;
};

class myTimeoutHandlerFactory : public vmime::net::timeoutHandlerFactory
{
    public:
        ref <timeoutHandler> create ()
        {
            return vmime::create <myTimeoutHandler>();
        }
};

I tried giving vmime::ref in the place of ref , it gives new error,

Svr.h:158: error: 'timeoutHandler' was not declared in this scope
Svr.h:158: error: template argument 1 is invalid

Can someone please help.Thanks

EDIT:

Iam calling this part of the code in my.C file like this

tr->setTimeoutHandlerFactory(vmime::create <myTimeoutHandlerFactory>());
È stato utile?

Soluzione

Looks like you don't have a type called timeoutHandler but you do have one called myTimeoutHandler. Perhaps you meant:

vmime::ref<myTimeoutHandler>

Or maybe you want the timeoutHandler defined in the vmime::net namespace:

vmime::ref<vmime::net::timeoutHandler>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top