Blame SOURCES/nmap-6.40-ncat_early_error_reporting.patch

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