mirror of
https://github.com/sogou/workflow.git
synced 2026-10-29 11:36:47 +08:00
fix mysql message seqid bug
This commit is contained in:
@@ -122,6 +122,7 @@ int MySQLMessage::encode(struct iovec vectors[], int max)
|
||||
const unsigned char *p = (unsigned char *)buf_.c_str();
|
||||
size_t nleft = buf_.size();
|
||||
uint8_t seqid_start = seqid_;
|
||||
uint8_t seqid = seqid_;
|
||||
unsigned char *head;
|
||||
uint32_t length;
|
||||
int i = 0;
|
||||
@@ -130,9 +131,9 @@ int MySQLMessage::encode(struct iovec vectors[], int max)
|
||||
{
|
||||
length = (nleft >= MYSQL_PAYLOAD_MAX ? MYSQL_PAYLOAD_MAX
|
||||
: (uint32_t)nleft);
|
||||
head = heads_[seqid_];
|
||||
head = heads_[seqid];
|
||||
int3store(head, length);
|
||||
head[3] = seqid_++;
|
||||
head[3] = seqid++;
|
||||
vectors[i].iov_base = head;
|
||||
vectors[i].iov_len = 4;
|
||||
i++;
|
||||
@@ -148,7 +149,7 @@ int MySQLMessage::encode(struct iovec vectors[], int max)
|
||||
|
||||
nleft -= MYSQL_PAYLOAD_MAX;
|
||||
p += length;
|
||||
} while (seqid_ != seqid_start);
|
||||
} while (seqid != seqid_start);
|
||||
|
||||
errno = EOVERFLOW;
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user