dcb's fd wasn't stored to client's protocol structure. Changed mysql_protocol_init to take fd as the Second argument.
This commit is contained in:
@ -239,7 +239,7 @@ typedef enum
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void gw_mysql_close(MySQLProtocol **ptr);
|
void gw_mysql_close(MySQLProtocol **ptr);
|
||||||
MySQLProtocol* mysql_protocol_init(DCB* dcb);
|
MySQLProtocol* mysql_protocol_init(DCB* dcb, int fd);
|
||||||
MySQLProtocol *gw_mysql_init(MySQLProtocol *data);
|
MySQLProtocol *gw_mysql_init(MySQLProtocol *data);
|
||||||
void gw_mysql_close(MySQLProtocol **ptr);
|
void gw_mysql_close(MySQLProtocol **ptr);
|
||||||
int gw_receive_backend_auth(MySQLProtocol *conn);
|
int gw_receive_backend_auth(MySQLProtocol *conn);
|
||||||
|
|||||||
@ -503,7 +503,7 @@ static int gw_create_backend_connection(
|
|||||||
int rv = -1;
|
int rv = -1;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
|
|
||||||
protocol = mysql_protocol_init(backend_dcb);
|
protocol = mysql_protocol_init(backend_dcb, -1);
|
||||||
ss_dassert(protocol != NULL);
|
ss_dassert(protocol != NULL);
|
||||||
|
|
||||||
if (protocol == NULL) {
|
if (protocol == NULL) {
|
||||||
@ -517,8 +517,6 @@ static int gw_create_backend_connection(
|
|||||||
|
|
||||||
/** if succeed, fd > 0, -1 otherwise */
|
/** if succeed, fd > 0, -1 otherwise */
|
||||||
rv = gw_do_connect_to_backend(server->name, server->port, &fd);
|
rv = gw_do_connect_to_backend(server->name, server->port, &fd);
|
||||||
/** Assign fd with protocol */
|
|
||||||
protocol->fd = fd;
|
|
||||||
/** Assign protocol with backend_dcb */
|
/** Assign protocol with backend_dcb */
|
||||||
backend_dcb->protocol = protocol;
|
backend_dcb->protocol = protocol;
|
||||||
|
|
||||||
|
|||||||
@ -957,7 +957,7 @@ int gw_MySQLAccept(DCB *listener)
|
|||||||
client_dcb->fd = c_sock;
|
client_dcb->fd = c_sock;
|
||||||
client_dcb->remote = strdup(inet_ntoa(local.sin_addr));
|
client_dcb->remote = strdup(inet_ntoa(local.sin_addr));
|
||||||
|
|
||||||
protocol = mysql_protocol_init(client_dcb);
|
protocol = mysql_protocol_init(client_dcb, c_sock);
|
||||||
ss_dassert(protocol != NULL);
|
ss_dassert(protocol != NULL);
|
||||||
|
|
||||||
if (protocol == NULL) {
|
if (protocol == NULL) {
|
||||||
|
|||||||
@ -54,7 +54,8 @@ extern int gw_error_backend_event(DCB *dcb);
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
MySQLProtocol* mysql_protocol_init(
|
MySQLProtocol* mysql_protocol_init(
|
||||||
DCB* dcb)
|
DCB* dcb,
|
||||||
|
int fd)
|
||||||
{
|
{
|
||||||
MySQLProtocol* p;
|
MySQLProtocol* p;
|
||||||
|
|
||||||
@ -78,6 +79,8 @@ MySQLProtocol* mysql_protocol_init(
|
|||||||
p->protocol_chk_top = CHK_NUM_PROTOCOL;
|
p->protocol_chk_top = CHK_NUM_PROTOCOL;
|
||||||
p->protocol_chk_tail = CHK_NUM_PROTOCOL;
|
p->protocol_chk_tail = CHK_NUM_PROTOCOL;
|
||||||
#endif
|
#endif
|
||||||
|
/** Assign fd with protocol */
|
||||||
|
p->fd = fd;
|
||||||
p->owner_dcb = dcb;
|
p->owner_dcb = dcb;
|
||||||
CHK_PROTOCOL(p);
|
CHK_PROTOCOL(p);
|
||||||
return_p:
|
return_p:
|
||||||
@ -547,7 +550,7 @@ int gw_do_connect_to_backend(
|
|||||||
skygw_log_write_flush(
|
skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"%lu [gw_do_connect_to_backend] Establishing connection "
|
"%lu [gw_do_connect_to_backend] Establishing connection "
|
||||||
"to back-end server failed. Socket creation failed due "
|
"to backend server failed. Socket creation failed due "
|
||||||
"%d, %s.",
|
"%d, %s.",
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
eno,
|
eno,
|
||||||
|
|||||||
Reference in New Issue
Block a user