MXS-1506: Remove unused MXS_UPSTREAM variables

The `error` variable was never used. Also added a more convenient typedef
for both the downstream and upstream functions and updated filter API
version.
This commit is contained in:
Markus Mäkelä
2018-04-04 09:14:18 +03:00
parent c70216390f
commit cc793b2151
4 changed files with 7 additions and 7 deletions

View File

@ -214,7 +214,7 @@ typedef struct mxs_filter_object
* is changed these values must be updated in line with the rules in the * is changed these values must be updated in line with the rules in the
* file modinfo.h. * file modinfo.h.
*/ */
#define MXS_FILTER_VERSION {3, 0, 0} #define MXS_FILTER_VERSION {4, 0, 0}
/** /**
* MXS_FILTER_DEF represents a filter definition from the configuration file. * MXS_FILTER_DEF represents a filter definition from the configuration file.

View File

@ -118,11 +118,15 @@ typedef struct
struct mxs_filter; struct mxs_filter;
struct mxs_filter_session; struct mxs_filter_session;
// These are more convenient types
typedef int32_t (*DOWNSTREAMFUNC)(struct mxs_filter *instance, struct mxs_filter_session *session, GWBUF *response);
typedef int32_t (*UPSTREAMFUNC)(struct mxs_filter *instance, struct mxs_filter_session *session, GWBUF *response);
typedef struct mxs_downstream typedef struct mxs_downstream
{ {
struct mxs_filter *instance; struct mxs_filter *instance;
struct mxs_filter_session *session; struct mxs_filter_session *session;
int32_t (*routeQuery)(struct mxs_filter *instance, struct mxs_filter_session *session, GWBUF *request); DOWNSTREAMFUNC routeQuery;
} MXS_DOWNSTREAM; } MXS_DOWNSTREAM;
/** /**
@ -133,8 +137,7 @@ typedef struct mxs_upstream
{ {
struct mxs_filter *instance; struct mxs_filter *instance;
struct mxs_filter_session *session; struct mxs_filter_session *session;
int32_t (*clientReply)(struct mxs_filter *instance, struct mxs_filter_session *session, GWBUF *response); UPSTREAMFUNC clientReply;
int32_t (*error)(void *instance, void *session, void *);
} MXS_UPSTREAM; } MXS_UPSTREAM;
/** /**

View File

@ -1279,14 +1279,12 @@ static void session_deliver_response(MXS_SESSION* session)
session->response.up.instance = NULL; session->response.up.instance = NULL;
session->response.up.session = NULL; session->response.up.session = NULL;
session->response.up.clientReply = NULL; session->response.up.clientReply = NULL;
session->response.up.error = NULL;
session->response.buffer = NULL; session->response.buffer = NULL;
} }
ss_dassert(!session->response.up.instance); ss_dassert(!session->response.up.instance);
ss_dassert(!session->response.up.session); ss_dassert(!session->response.up.session);
ss_dassert(!session->response.up.clientReply); ss_dassert(!session->response.up.clientReply);
ss_dassert(!session->response.up.error);
ss_dassert(!session->response.buffer); ss_dassert(!session->response.buffer);
} }

View File

@ -74,7 +74,6 @@ void Client::set_as_upstream_on(FilterModule::Session& filter_session)
upstream.instance = &m_instance; upstream.instance = &m_instance;
upstream.session = this; upstream.session = this;
upstream.clientReply = &Client::clientReply; upstream.clientReply = &Client::clientReply;
upstream.error = NULL;
filter_session.setUpstream(&upstream); filter_session.setUpstream(&upstream);
} }