PROTON-2304: fix epoll proactor hang removing and replacing same canceled timer at front of timers list repeatedly
diff --git a/c/src/proactor/epoll_timer.c b/c/src/proactor/epoll_timer.c
index 6c7c3db..6d288e1 100644
--- a/c/src/proactor/epoll_timer.c
+++ b/c/src/proactor/epoll_timer.c
@@ -326,17 +326,19 @@
       lock(&tm->context.mutex);
     } else {
       uint64_t deadline = td->timer->deadline;
-      if (deadline && deadline <= now) {
-        td->timer->deadline = 0;
-        pconnection_t *pc = td->timer->connection;
-        lock(&tm->deletion_mutex);     // Prevent connection from deleting itself when tm->context.mutex dropped.
-        unlock(&tm->context.mutex);
-        pni_pconnection_timeout(pc);
-        unlock(&tm->deletion_mutex);
-        lock(&tm->context.mutex);
-      } else {
-        td->list_deadline = td->timer->deadline;
-        pn_list_minpush(tm->timers_heap, td);
+      if (deadline) {
+        if (deadline <= now) {
+          td->timer->deadline = 0;
+          pconnection_t *pc = td->timer->connection;
+          lock(&tm->deletion_mutex);     // Prevent connection from deleting itself when tm->context.mutex dropped.
+          unlock(&tm->context.mutex);
+          pni_pconnection_timeout(pc);
+          unlock(&tm->deletion_mutex);
+          lock(&tm->context.mutex);
+        } else {
+          td->list_deadline = deadline;
+          pn_list_minpush(tm->timers_heap, td);
+        }
       }
     }
   }