Blame SOURCES/nmap-6.40-ncat_early_error_reporting.patch

62a8fc
diff --git a/nsock/src/nsock_core.c b/nsock/src/nsock_core.c
62a8fc
index ec38cad..aac2c1b 100644
62a8fc
--- a/nsock/src/nsock_core.c
62a8fc
+++ b/nsock/src/nsock_core.c
62a8fc
@@ -1230,6 +1230,14 @@ void nsp_add_event(mspool *nsp, msevent *nse) {
62a8fc
       assert(0);
62a8fc
       break; /* unreached */
62a8fc
   }
62a8fc
+
62a8fc
+  /* It can happen that the event already completed. In which case we can
62a8fc
+   *    * already deliver it, even though we're probably not inside nsock_loop(). */
62a8fc
+  if (nse->event_done) {
62a8fc
+	  msevent_dispatch_and_delete(nsp, nse, 1);
62a8fc
+	  update_first_events(nse);
62a8fc
+	   
62a8fc
+  }
62a8fc
 }
62a8fc
 
62a8fc
 /* An event has been completed and the handler is about to be called. This