Various fixes
Various fixes for initialisation and packet size allocation
This commit is contained in:
@ -334,7 +334,7 @@ BLFILE *file;
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((file = (BLFILE *)malloc(sizeof(BLFILE))) == NULL)
|
if ((file = (BLFILE *)calloc(1, sizeof(BLFILE))) == NULL)
|
||||||
{
|
{
|
||||||
spinlock_release(&router->fileslock);
|
spinlock_release(&router->fileslock);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
@ -463,8 +463,9 @@ int query_len;
|
|||||||
"%s: Expected DISCONNECT SERVER $server_id",
|
"%s: Expected DISCONNECT SERVER $server_id",
|
||||||
router->service->name)));
|
router->service->name)));
|
||||||
} else {
|
} else {
|
||||||
|
int serverid = atoi(word);
|
||||||
free(query_text);
|
free(query_text);
|
||||||
return blr_slave_disconnect_server(router, slave, atoi(word));
|
return blr_slave_disconnect_server(router, slave, serverid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1075,7 +1076,7 @@ ROUTER_SLAVE *sptr;
|
|||||||
sprintf(port, "%d", sptr->port);
|
sprintf(port, "%d", sptr->port);
|
||||||
sprintf(master_id, "%d", router->serverid);
|
sprintf(master_id, "%d", router->serverid);
|
||||||
sprintf(slave_uuid, "%s", sptr->uuid ? sptr->uuid : "");
|
sprintf(slave_uuid, "%s", sptr->uuid ? sptr->uuid : "");
|
||||||
len = 5 + strlen(server_id) + strlen(host) + strlen(port)
|
len = 4 + strlen(server_id) + strlen(host) + strlen(port)
|
||||||
+ strlen(master_id) + strlen(slave_uuid) + 5;
|
+ strlen(master_id) + strlen(slave_uuid) + 5;
|
||||||
if ((pkt = gwbuf_alloc(len)) == NULL)
|
if ((pkt = gwbuf_alloc(len)) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1907,7 +1908,7 @@ int len, id_len, seqno = 2;
|
|||||||
strcpy(state, "not found");
|
strcpy(state, "not found");
|
||||||
|
|
||||||
id_len = strlen(serverid);
|
id_len = strlen(serverid);
|
||||||
len = 5 + id_len + strlen(state) + 1;
|
len = 4 + (1 + id_len) + (1 + strlen(state));
|
||||||
|
|
||||||
if ((pkt = gwbuf_alloc(len)) == NULL)
|
if ((pkt = gwbuf_alloc(len)) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1918,7 +1919,7 @@ int len, id_len, seqno = 2;
|
|||||||
blr_slave_send_eof(router, slave, seqno++);
|
blr_slave_send_eof(router, slave, seqno++);
|
||||||
|
|
||||||
ptr = GWBUF_DATA(pkt);
|
ptr = GWBUF_DATA(pkt);
|
||||||
encode_value(ptr, id_len + 2 + strlen(state), 24); // Add length of data packet
|
encode_value(ptr, len - 4), 24); // Add length of data packet
|
||||||
ptr += 3;
|
ptr += 3;
|
||||||
*ptr++ = seqno++; // Sequence number in response
|
*ptr++ = seqno++; // Sequence number in response
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user