Added missing type to GWBUF returned from mysql_backend.
This commit is contained in:
@ -532,8 +532,8 @@ return_packetbuf:
|
|||||||
/**
|
/**
|
||||||
* Parse the buffer and split complete packets into individual buffers.
|
* Parse the buffer and split complete packets into individual buffers.
|
||||||
* Any partial packets are left in the old buffer.
|
* Any partial packets are left in the old buffer.
|
||||||
* @param p_readbuf Buffer to split
|
* @param p_readbuf Buffer to split, set to NULL if no partial packets are left
|
||||||
* @return Head of the chain of complete packets
|
* @return Head of the chain of complete packets, all in a single, contiguous buffer
|
||||||
*/
|
*/
|
||||||
GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf)
|
GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf)
|
||||||
{
|
{
|
||||||
@ -546,18 +546,19 @@ GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
packet = gwbuf_make_contiguous(*p_readbuf);
|
packet = gwbuf_make_contiguous(*p_readbuf);
|
||||||
|
packet->next = NULL;
|
||||||
*p_readbuf = packet;
|
*p_readbuf = packet;
|
||||||
ptr = (uint8_t*)packet->start;
|
ptr = (uint8_t*)packet->start;
|
||||||
end = (uint8_t*)packet->end;
|
end = (uint8_t*)packet->end;
|
||||||
len = gw_mysql_get_byte3(ptr) + 4;
|
len = gw_mysql_get_byte3(ptr) + 4;
|
||||||
blen = gwbuf_length(packet);
|
blen = gwbuf_length(packet);
|
||||||
|
|
||||||
if(ptr + len == end)
|
if(len == blen)
|
||||||
{
|
{
|
||||||
*p_readbuf = NULL;
|
*p_readbuf = NULL;
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
else if(ptr + len > end)
|
else if(len > blen)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -570,7 +571,6 @@ GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Full packets only, return original */
|
/** Full packets only, return original */
|
||||||
|
|
||||||
if(total + len == blen)
|
if(total + len == blen)
|
||||||
{
|
{
|
||||||
*p_readbuf = NULL;
|
*p_readbuf = NULL;
|
||||||
@ -578,7 +578,6 @@ GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The next packet is a partial, split into complete and partial packets */
|
/** The next packet is a partial, split into complete and partial packets */
|
||||||
|
|
||||||
if((buff = gwbuf_alloc(total)) == NULL)
|
if((buff = gwbuf_alloc(total)) == NULL)
|
||||||
{
|
{
|
||||||
skygw_log_write(LOGFILE_ERROR,
|
skygw_log_write(LOGFILE_ERROR,
|
||||||
@ -588,7 +587,8 @@ GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf)
|
|||||||
total);
|
total);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
buff->next = NULL;
|
||||||
|
gwbuf_set_type(buff,GWBUF_TYPE_MYSQL);
|
||||||
memcpy(buff->start,packet->start,total);
|
memcpy(buff->start,packet->start,total);
|
||||||
gwbuf_consume(packet,total);
|
gwbuf_consume(packet,total);
|
||||||
return buff;
|
return buff;
|
||||||
|
@ -492,15 +492,17 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
{
|
{
|
||||||
ss_dassert(read_buffer != NULL || dcb->dcb_readqueue != NULL);
|
ss_dassert(read_buffer != NULL || dcb->dcb_readqueue != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dcb->dcb_readqueue)
|
if(dcb->dcb_readqueue)
|
||||||
{
|
{
|
||||||
read_buffer = gwbuf_append(dcb->dcb_readqueue,read_buffer);
|
read_buffer = gwbuf_append(dcb->dcb_readqueue,read_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
nbytes_read = gwbuf_length(read_buffer);
|
nbytes_read = gwbuf_length(read_buffer);
|
||||||
|
|
||||||
if (nbytes_read < 3)
|
if (nbytes_read < 3)
|
||||||
{
|
{
|
||||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
dcb->dcb_readqueue = read_buffer;
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto return_rc;
|
goto return_rc;
|
||||||
}
|
}
|
||||||
@ -510,7 +512,8 @@ static int gw_read_backend_event(DCB *dcb) {
|
|||||||
|
|
||||||
if(tmp == NULL)
|
if(tmp == NULL)
|
||||||
{
|
{
|
||||||
dcb->dcb_readqueue = gwbuf_append(dcb->dcb_readqueue, read_buffer);
|
/** No complete packets */
|
||||||
|
dcb->dcb_readqueue = read_buffer;
|
||||||
rc = 0;
|
rc = 0;
|
||||||
goto return_rc;
|
goto return_rc;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user