Files
MaxScale/server/core/internal
Johan Wikman be9504ac94 MXS-1754 Add possibility to cancel delayed calls
The interface for canceling calls is now geared towards the needs
of sessions. Basically the idea is as follows:

class MyFilterSession : public maxscale::FilterSession
{
    ...
    int MyFilterSession::routeQuery(GWBUF* pPacket)
    {
       ...
       if (needs_to_be_delayed())
       {
           Worker* pWorker = Worker::current();
           void* pTag = this;
           pWorker->delayed_call(5000, pTag, this,
                                 &MyFilterSession::delayed_routeQuery,
                                 pPacket);
           return 1;
       }
       ...
    }

    bool MyFilterSession::delayed_routeQuery(Worker::Call:action_t action,
                                             GWBUF* pPacket)
    {
        if (action == Worker::Call::EXECUTE)
        {
            routeQuery(pPacket);
        }
        else
        {
            ss_dassert(action == Worker::Call::CANCEL);
            gwbuf_free(pPacket);
        }
        return false;
    }

    ~MyFilterSession()
    {
        void* pTag = this;
        Worker::current()->cancel_delayed_calls(pTag);
    }
}

The alternative, returning some key that the caller must keep
around seems more cumbersome for the general case.
2018-04-23 13:58:00 +03:00
..
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-12-29 08:34:46 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-12-22 11:45:32 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00
2017-11-22 18:40:18 +02:00