Merge branch '2.1' into 2.2

This commit is contained in:
Markus Mäkelä 2018-04-10 13:49:42 +03:00
commit fad4508fe2
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
4 changed files with 21 additions and 9 deletions

View File

@ -349,7 +349,7 @@ extern void server_transfer_status(SERVER *dest_server, const SERVER *source_ser
extern void server_add_mon_user(SERVER *server, const char *user, const char *passwd);
extern const char *server_get_parameter(const SERVER *server, const char *name);
extern void server_update_credentials(SERVER *server, const char *user, const char *passwd);
extern DCB *server_get_persistent(SERVER *server, const char *user, const char *protocol, int id);
extern DCB* server_get_persistent(SERVER *server, const char *user, const char* ip, const char *protocol, int id);
extern void server_update_address(SERVER *server, const char *address);
extern void server_update_port(SERVER *server, unsigned short port);
extern uint64_t server_map_status(const char *str);

View File

@ -386,7 +386,8 @@ dcb_connect(SERVER *server, MXS_SESSION *session, const char *protocol)
if (user && strlen(user))
{
MXS_DEBUG("Looking for persistent connection DCB user %s protocol %s", user, protocol);
dcb = server_get_persistent(server, user, protocol, session->client_dcb->poll.thread.id);
dcb = server_get_persistent(server, user, session->client_dcb->remote,
protocol, session->client_dcb->thread.id);
if (dcb)
{
/**
@ -423,6 +424,11 @@ dcb_connect(SERVER *server, MXS_SESSION *session, const char *protocol)
memcpy(&(dcb->func), funcs, sizeof(MXS_PROTOCOL));
dcb->protoname = MXS_STRDUP_A(protocol);
if (session->client_dcb->remote)
{
dcb->remote = MXS_STRDUP_A(session->client_dcb->remote);
}
const char *authenticator = server->authenticator ?
server->authenticator : dcb->func.auth_default ?
dcb->func.auth_default() : "NullAuthDeny";

View File

@ -213,12 +213,15 @@ server_free(SERVER *tofreeserver)
/**
* Get a DCB from the persistent connection pool, if possible
*
* @param server The server to set the name on
* @param user The name of the user needing the connection
* @param protocol The name of the protocol needed for the connection
* @param server The server to set the name on
* @param user The name of the user needing the connection
* @param ip Client IP address
* @param protocol The name of the protocol needed for the connection
* @param id Thread ID
*
* @return A DCB or NULL if no connection is found
*/
DCB *
server_get_persistent(SERVER *server, const char *user, const char *protocol, int id)
DCB* server_get_persistent(SERVER *server, const char *user, const char* ip, const char *protocol, int id)
{
DCB *dcb, *previous = NULL;
@ -232,9 +235,12 @@ server_get_persistent(SERVER *server, const char *user, const char *protocol, in
{
if (dcb->user
&& dcb->protoname
&& dcb->remote
&& ip
&& !dcb-> dcb_errhandle_called
&& !(dcb->flags & DCBF_HUNG)
&& 0 == strcmp(dcb->user, user)
&& 0 == strcmp(dcb->remote, ip)
&& 0 == strcmp(dcb->protoname, protocol))
{
if (NULL == previous)

View File

@ -334,8 +334,8 @@ int MySQLSendHandshake(DCB* dcb)
mysql_server_capabilities_one[1] = (uint8_t)(GW_MYSQL_CAPABILITIES_SERVER >> 8);
// Check that we match the old values
ss_dassert(mysql_server_capabilities_one[0] = 0xff);
ss_dassert(mysql_server_capabilities_one[1] = 0xf7);
ss_dassert(mysql_server_capabilities_one[0] == 0xff);
ss_dassert(mysql_server_capabilities_one[1] == 0xf7);
if (is_maria)
{