Fixed needed msg len

This commit is contained in:
Vysheng 2013-10-23 21:56:29 +04:00
parent d289aeb897
commit 045467b0df
3 changed files with 8 additions and 2 deletions

View File

@ -1153,6 +1153,9 @@ int rpc_execute (struct connection *c, int op, int len) {
int Response_len = len;
if (verbosity >= 2) {
logprintf ("Response_len = %d\n", Response_len);
}
assert (read_in (c, Response, Response_len) == Response_len);
Response[Response_len] = 0;
if (verbosity >= 2) {

4
net.c
View File

@ -298,12 +298,12 @@ void try_rpc_read (struct connection *c) {
unsigned t = 0;
assert (read_in_lookup (c, &len, 1) == 1);
if (len >= 1 && len <= 0x7e) {
if (c->in_bytes < (int)(4 * len)) { return; }
if (c->in_bytes < (int)(1 + 4 * len)) { return; }
} else {
if (c->in_bytes < 4) { return; }
assert (read_in_lookup (c, &len, 4) == 4);
len = (len >> 8);
if (c->in_bytes < (int)(4 * len)) { return; }
if (c->in_bytes < (int)(4 + 4 * len)) { return; }
len = 0x7f;
}

View File

@ -56,6 +56,9 @@ struct query *query_get (long long id) {
int alarm_query (struct query *q) {
assert (q);
if (verbosity) {
logprintf ("Alarm query %lld\n", q->msg_id);
}
q->ev.timeout = get_double_time () + QUERY_TIMEOUT;
insert_event_timer (&q->ev);
return 0;