From b09a2719a7820cef58a251ccb2ce286754114a0a Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Wed, 29 Mar 2017 02:12:40 +0200 Subject: lib: Revise handling CDAP messages Fixes a number of issues in CDAP. CDAP keeps track if a message is being processed, and moves it to the end of the request list if it is. It will now correctly wait for new messages. The invoke_ids are generated locally per CDAP instance, invoke_ids can't be used to track incoming requests, we need to keep track of the fd. The keys are now identifiers (taken from the same local pool as the invoke_ids) that are used to track requests. --- src/lib/cdap_req.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/lib/cdap_req.h') diff --git a/src/lib/cdap_req.h b/src/lib/cdap_req.h index fe8e3613..592d26a0 100644 --- a/src/lib/cdap_req.h +++ b/src/lib/cdap_req.h @@ -31,6 +31,8 @@ #include +typedef cdap_key_t invoke_id_t; + enum creq_state { REQ_NULL = 0, REQ_INIT, @@ -46,6 +48,7 @@ struct cdap_req { int fd; struct timespec birth; cdap_key_t key; + invoke_id_t iid; int response; buffer_t data; @@ -55,8 +58,9 @@ struct cdap_req { pthread_mutex_t lock; }; -struct cdap_req * cdap_req_create(int fd, - cdap_key_t key); +struct cdap_req * cdap_req_create(int fd, + cdap_key_t key, + invoke_id_t iid); void cdap_req_destroy(struct cdap_req * creq); -- cgit v1.2.3