patch 8.0.0312: failure when a channel receives a split json message
Problem: When a json message arrives in pieces, the start is dropped and
the decoding fails.
Solution: Do not drop the start when it is still needed. (Kay Zheng) Add a
test. Reset the timeout when something is received.
diff --git a/src/structs.h b/src/structs.h
index 45bd4a5..a53a125 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1563,9 +1563,11 @@
jsonq_T ch_json_head; /* header for circular json read queue */
int ch_block_id; /* ID that channel_read_json_block() is
waiting for */
- /* When ch_waiting is TRUE use ch_deadline to wait for incomplete message
- * to be complete. */
- int ch_waiting;
+ /* When ch_wait_len is non-zero use ch_deadline to wait for incomplete
+ * message to be complete. The value is the length of the incomplete
+ * message when the deadline was set. If it gets longer (something was
+ * received) the deadline is reset. */
+ size_t ch_wait_len;
#ifdef WIN32
DWORD ch_deadline;
#else