Files
MaxScale/server/core/test
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
..
2018-01-22 15:29:21 +02:00
2014-08-20 11:07:28 +01:00
2018-01-22 15:29:21 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2017-11-22 18:40:18 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2018-01-05 09:58:10 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2017-11-22 18:40:18 +02:00
2018-01-24 11:20:11 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2017-11-10 14:45:54 +02:00
2017-12-29 08:42:49 +02:00
2018-01-22 15:29:21 +02:00
2017-11-10 14:45:54 +02:00