From 8352278379081b24076948a993a2aea041ba56f4 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 24 Feb 2006 04:03:38 +0000
Subject: [PATCH] avoid locking on accept

---
 Fltk/GmshServer.h | 3 ++-
 Fltk/Solvers.cpp  | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Fltk/GmshServer.h b/Fltk/GmshServer.h
index 8cf04c3375..8c2cac5874 100644
--- a/Fltk/GmshServer.h
+++ b/Fltk/GmshServer.h
@@ -194,7 +194,8 @@ class GmshServer {
     
     if(justwait){
       // wait indefinitely until we get data, polling every 10 ms
-      WaitForData(s, -1, 10, 1.);
+      if(WaitForData(s, -1, 10, 1.))
+	return -6; // not an actual error: we just stopped listening
     }
     else{
       // Wait at most _maxdelay seconds for data, issue error if no
diff --git a/Fltk/Solvers.cpp b/Fltk/Solvers.cpp
index d714663133..203ab336bb 100644
--- a/Fltk/Solvers.cpp
+++ b/Fltk/Solvers.cpp
@@ -1,4 +1,4 @@
-// $Id: Solvers.cpp,v 1.45 2006-02-24 03:30:21 geuzaine Exp $
+// $Id: Solvers.cpp,v 1.46 2006-02-24 04:03:38 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -156,6 +156,10 @@ int Solver(int num, char *args)
     case -5:
       Msg(GERROR, "Socket accept failed on '%s'", sockname);
       break;
+    case -6:
+      Msg(INFO, "Stopped listening for solver connections");
+      server.StopClient();
+      break;
     }
     if(num >= 0){
       for(int i = 0; i < SINFO[num].nboptions; i++)
-- 
GitLab