From b2ec65a10ae77d37095c77236bec8f1af95ff4c8 Mon Sep 17 00:00:00 2001
From: Michael Jerris <mike@jerris.com>
Date: Mon, 26 Apr 2010 01:13:10 -0400
Subject: [PATCH] more efficient check

---
 libs/esl/src/esl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c
index 70c91a2d20..d2ca396546 100644
--- a/libs/esl/src/esl.c
+++ b/libs/esl/src/esl.c
@@ -786,7 +786,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms
 		return ESL_FAIL;
 	}
 
-	if (esl_mutex_trylock(handle->mutex) != ESL_SUCCESS) {
+	if (activity == 0 || !FD_ISSET(handle->sock, &rfds) || (esl_mutex_trylock(handle->mutex) != ESL_SUCCESS)) {
 		return ESL_BREAK;
 	}