diff options
Diffstat (limited to 'rotord/rotord.cpp')
| -rwxr-xr-x | rotord/rotord.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/rotord/rotord.cpp b/rotord/rotord.cpp index 8790d39..77725ff 100755 --- a/rotord/rotord.cpp +++ b/rotord/rotord.cpp @@ -61,10 +61,19 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS if (request.getMethod()=="PUT") { //unofficial manual thread name if (body.size()) { string sID=body; - cerr << "Rotor: starting thread "<< sID << endl; - manager.start(new Rotor::Render_context(sID)); - XML.addValue("sID",sID); - status=HTTPResponse::HTTP_OK; + bool found=false; + for (auto& task: manager.taskList()) { + if(task->name()==sID) { + XML.addValue("error","Render context /"+sID+"/ exists already"); + found=true; + } + } + if (!found){ + cerr << "Rotor: starting thread "<< sID << endl; + manager.start(new Rotor::Render_context(sID)); + XML.addValue("sID",sID); + status=HTTPResponse::HTTP_OK; + } } } } |
