dcb.c, gw_utils.c, mysql_server_protocol.h, mysql_client.c : Replaced gw_read_gwbuff with dcb_read in mysql_client.c:gw_read_client_event.
rwsplit.sh, test_sescmd.sql : Added test case for session commands.
This commit is contained in:
@ -157,62 +157,6 @@ void gw_daemonize(void) {
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Read data from dcb and store it in the gwbuf
|
||||
/////////////////////////////////////////////////
|
||||
int gw_read_gwbuff(DCB *dcb, GWBUF **head, int b) {
|
||||
GWBUF *buffer = NULL;
|
||||
int n = -1;
|
||||
|
||||
if (b <= 0) {
|
||||
ss_dassert(false);
|
||||
#if 0
|
||||
dcb->func.close(dcb);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (b > 0) {
|
||||
int bufsize = b < MAX_BUFFER_SIZE ? b : MAX_BUFFER_SIZE;
|
||||
if ((buffer = gwbuf_alloc(bufsize)) == NULL) {
|
||||
/* Bad news, we have run out of memory */
|
||||
/* Error handling */
|
||||
(dcb->func).close(dcb);
|
||||
return 1;
|
||||
}
|
||||
|
||||
GW_NOINTR_CALL(n = read(dcb->fd, GWBUF_DATA(buffer), bufsize); dcb->stats.n_reads++);
|
||||
|
||||
if (n < 0) {
|
||||
if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
|
||||
gwbuf_free(buffer);
|
||||
return 1;
|
||||
} else {
|
||||
gwbuf_free(buffer);
|
||||
(dcb->func).close(dcb);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (n == 0) {
|
||||
// socket closed
|
||||
gwbuf_free(buffer);
|
||||
#if 1
|
||||
(dcb->func).close(dcb);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
// append read data to the gwbuf
|
||||
*head = gwbuf_append(*head, buffer);
|
||||
|
||||
// how many bytes left
|
||||
b -= n;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the bind config data. This is passed in a string as address:port.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user