MXS-1267: Use local client in tee
The tee filter now uses the local client class to clone the queries. This imposes some restrictions on how the filter can be used but also makes MaxScale as a whole more robust.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
add_library(tee SHARED tee.cc)
|
||||
target_link_libraries(tee maxscale-common)
|
||||
add_library(tee SHARED tee.cc local_client.cc)
|
||||
target_link_libraries(tee maxscale-common MySQLCommon)
|
||||
set_target_properties(tee PROPERTIES VERSION "1.0.0")
|
||||
install_module(tee core)
|
||||
|
||||
@ -34,10 +34,10 @@ LocalClient::LocalClient(MXS_SESSION* session, int fd):
|
||||
{
|
||||
MXS_POLL_DATA::handler = LocalClient::poll_handler;
|
||||
MySQLProtocol* client = (MySQLProtocol*)m_session->client_dcb->protocol;
|
||||
m_proto = {};
|
||||
m_proto.charset = client->charset;
|
||||
m_proto.client_capabilities = client->client_capabilities;
|
||||
m_proto.extra_capabilities = client->extra_capabilities;
|
||||
m_protocol = {};
|
||||
m_protocol.charset = client->charset;
|
||||
m_protocol.client_capabilities = client->client_capabilities;
|
||||
m_protocol.extra_capabilities = client->extra_capabilities;
|
||||
}
|
||||
|
||||
LocalClient::~LocalClient()
|
||||
@ -48,7 +48,7 @@ LocalClient::~LocalClient()
|
||||
}
|
||||
}
|
||||
|
||||
bool LocalClient::query(GWBUF* buffer)
|
||||
bool LocalClient::queue_query(GWBUF* buffer)
|
||||
{
|
||||
GWBUF* my_buf = gwbuf_clone(buffer);
|
||||
|
||||
@ -82,9 +82,9 @@ void LocalClient::process(uint32_t events)
|
||||
{
|
||||
if (m_state == VC_WAITING_HANDSHAKE)
|
||||
{
|
||||
if (gw_decode_mysql_server_handshake(&m_proto, GWBUF_DATA(buf) + MYSQL_HEADER_LEN) == 0)
|
||||
if (gw_decode_mysql_server_handshake(&m_protocol, GWBUF_DATA(buf) + MYSQL_HEADER_LEN) == 0)
|
||||
{
|
||||
GWBUF* response = gw_generate_auth_response(m_session, &m_proto, false, false);
|
||||
GWBUF* response = gw_generate_auth_response(m_session, &m_protocol, false, false);
|
||||
m_queue.push_front(response);
|
||||
m_state = VC_RESPONSE_SENT;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ public:
|
||||
*
|
||||
* @return True if query was successfully queued
|
||||
*/
|
||||
bool query(GWBUF* buffer);
|
||||
bool queue_query(GWBUF* buffer);
|
||||
|
||||
private:
|
||||
LocalClient(MXS_SESSION* session, int fd);
|
||||
@ -71,5 +71,5 @@ private:
|
||||
size_t m_expected_bytes;
|
||||
std::deque<mxs::Buffer> m_queue;
|
||||
MXS_SESSION* m_session;
|
||||
MySQLProtocol m_proto;
|
||||
MySQLProtocol m_protocol;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user