summaryrefslogtreecommitdiff
path: root/ecp/src/timer.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-08-29 16:25:40 +0200
committerUros Majstorovic <majstor@majstor.org>2021-08-29 16:25:40 +0200
commitff7ffade2f5686ae977af578cb87040cc4654994 (patch)
tree9b44f006a0d70535095928dcff06d7f26abe59e2 /ecp/src/timer.c
parentcdaa2560c0271585317450b57047a7f812d8366e (diff)
ecp code cleanup
Diffstat (limited to 'ecp/src/timer.c')
-rw-r--r--ecp/src/timer.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ecp/src/timer.c b/ecp/src/timer.c
index 5460437..7dd3c50 100644
--- a/ecp/src/timer.c
+++ b/ecp/src/timer.c
@@ -2,7 +2,8 @@
#include "tm.h"
int ecp_timer_create(ECPTimer *timer) {
- int rv = ECP_OK;
+ int rv;
+
timer->head = -1;
#ifdef ECP_WITH_PTHREAD
@@ -180,16 +181,17 @@ ecp_cts_t ecp_timer_exe(ECPSocket *sock) {
#endif
for (i=to_exec_size-1; i>=0; i--) {
- int rv = ECP_OK;
ECPConnection *conn = to_exec[i].conn;
unsigned char mtype = to_exec[i].mtype;
ecp_timer_retry_t retry = to_exec[i].retry;
ecp_conn_handler_msg_t handler = conn->sock->ctx->handler[conn->type] ? conn->sock->ctx->handler[conn->type]->msg[mtype & ECP_MTYPE_MASK] : NULL;
+ int rv = ECP_OK;
if (to_exec[i].cnt > 0) {
- ssize_t _rv = 0;
to_exec[i].cnt--;
if (retry) {
+ ssize_t _rv;
+
_rv = retry(conn, to_exec+i);
if (_rv < 0) rv = _rv;
}
@@ -212,8 +214,8 @@ ecp_cts_t ecp_timer_exe(ECPSocket *sock) {
}
ssize_t ecp_timer_send(ECPConnection *conn, ecp_timer_retry_t send_f, unsigned char mtype, short cnt, ecp_cts_t timeout) {
- int rv = ECP_OK;
ECPTimerItem ti;
+ int rv;
rv = ecp_timer_item_init(&ti, conn, mtype, cnt, timeout);
if (rv) return rv;