summaryrefslogtreecommitdiff
path: root/code/core/msgq.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2017-08-18 20:35:21 +0200
committerUros Majstorovic <majstor@majstor.org>2017-08-18 20:35:21 +0200
commit5d20e9bafc3571f37eb0d9b74699d023d2d3d13a (patch)
treebb26005ff3ed2564212ac84cfa336ee6e97ffb93 /code/core/msgq.c
parent8f44e2151cb3f91b220c4a3393a06068d0ee7302 (diff)
timer fixed; rbuf almost implemented
Diffstat (limited to 'code/core/msgq.c')
-rw-r--r--code/core/msgq.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/code/core/msgq.c b/code/core/msgq.c
index 15629c8..4c1252b 100644
--- a/code/core/msgq.c
+++ b/code/core/msgq.c
@@ -79,7 +79,9 @@ int ecp_conn_msgq_push(ECPConnection *conn, ecp_seq_t seq, unsigned char mtype)
ECPRBRecv *buf = conn->rbuf.recv;
ECPConnMsgQ *msgq = buf ? &buf->msgq : NULL;
+ mtype &= ECP_MTYPE_MASK;
if (msgq == NULL) return ECP_ERR;
+ if (mtype >= ECP_MAX_MTYPE) return ECP_ERR_MAX_MTYPE;
if (msgq->idx_w[mtype] - msgq->idx_r[mtype] == ECP_MSGQ_MAX_MSG) return ECP_MSGQ_ERR_MAX_MSG;
if (msgq->idx_w[mtype] == msgq->idx_r[mtype]) pthread_cond_signal(&msgq->cond[mtype]);