remove noneed protocol and the comparison corrent

This commit is contained in:
Dapeng Huang
2018-01-15 21:38:20 +08:00
parent d234b13027
commit 6d3c60eb28
3 changed files with 6 additions and 10 deletions

View File

@ -199,7 +199,6 @@ typedef enum
} DCB_USAGE;
/* A few useful macros */
#define DCB_SERVICE(x, type) (type *)((x)->service)
#define DCB_SESSION(x) (x)->session
#define DCB_PROTOCOL(x, type) (type *)((x)->protocol)
#define DCB_WRITEQLEN(x) (x)->writeqlen

View File

@ -411,9 +411,7 @@ int MySQLSendHandshake(DCB* dcb)
*/
int gw_MySQLWrite_client(DCB *dcb, GWBUF *queue)
{
MySQLProtocol *protocol = DCB_PROTOCOL(dcb, MySQLProtocol);
SERVICE *service = DCB_SERVICE(dcb, SERVICE);
if (GWBUF_IS_REPLY_OK(queue) && service->session_track_trx_state)
if (GWBUF_IS_REPLY_OK(queue) && dcb->service->session_track_trx_state)
{
parse_and_set_trx_state(dcb->session, queue);
}
@ -1514,9 +1512,8 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
goto return_rc;
}
}
SERVICE *service = DCB_SERVICE(session->client_dcb, SERVICE);
if (rcap_type_required(capabilities, RCAP_TYPE_TRANSACTION_TRACKING) && service->session_track_trx_state)
SERVICE *service = session->client_dcb->service;
if (rcap_type_required(capabilities, RCAP_TYPE_TRANSACTION_TRACKING) && !service->session_track_trx_state)
{
if (session_trx_is_ending(session))
{

View File

@ -1798,13 +1798,13 @@ void mxs_mysql_get_session_track_info(GWBUF *buff, uint32_t server_capabilities)
if (server_capabilities & GW_MYSQL_CAPABILITIES_SESSION_TRACK)
{
if (ptr < buff->end)
if (ptr < (local_buf+len))
{
ptr += mxs_leint_consume(&ptr); // info
if (server_status & SERVER_SESSION_STATE_CHANGED)
{
mxs_leint_consume(&ptr); // total SERVER_SESSION_STATE_CHANGED length
while (ptr < buff->end)
while (ptr < (local_buf+len))
{
enum_session_state_type type = (enum enum_session_state_type)mxs_leint_consume(&ptr);
switch (type)