Skip to content
Snippets Groups Projects
Commit 71fd23c5 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

allow multiple reconnects (with -listen)

parent 9ac206ac
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,7 @@ class FlGmshServer : public GmshServer{ ...@@ -50,7 +50,7 @@ class FlGmshServer : public GmshServer{
if(timeout > 0 && GetTimeInSeconds() - start > timeout) if(timeout > 0 && GetTimeInSeconds() - start > timeout)
return 2; // timout return 2; // timout
if((_remote->executable.size() && _remote->getPid() < 0) || if(_remote->getPid() < 0 ||
(_remote->executable.empty() && !CTX::instance()->solver.listen)) (_remote->executable.empty() && !CTX::instance()->solver.listen))
return 1; // process has been killed or we stopped listening return 1; // process has been killed or we stopped listening
...@@ -147,13 +147,13 @@ void GmshRemote::run(std::string args) ...@@ -147,13 +147,13 @@ void GmshRemote::run(std::string args)
bool initOption[5] = {true, true, true, true, true}; bool initOption[5] = {true, true, true, true, true};
while(1) { while(1) {
if((prog.size() && _pid < 0) || if(_pid < 0 || (prog.empty() && !CTX::instance()->solver.listen))
(prog.empty() && !CTX::instance()->solver.listen)) break; break;
int stop = server->NonBlockingWait(sock, 0.1, 0.); int stop = server->NonBlockingWait(sock, 0.1, 0.);
if(stop || (prog.size() && _pid < 0) || if(stop || _pid < 0 || (prog.empty() && !CTX::instance()->solver.listen))
(prog.empty() && !CTX::instance()->solver.listen)) break; break;
int type, length; int type, length;
if(server->ReceiveHeader(&type, &length)){ if(server->ReceiveHeader(&type, &length)){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment