summaryrefslogtreecommitdiff
path: root/rotord
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2013-09-03 17:11:27 +0100
committerTim Redfern <tim@eclectronics.org>2013-09-03 17:11:27 +0100
commitf84aea7f9dac2c01f917aaebd8c95ea3446d8bee (patch)
tree229f2cff55bc3c87021ed40d80c1a334da8e7f99 /rotord
parentf316c9f73a63df12def9a640038bd526c470f5fd (diff)
change blocking pattern
Diffstat (limited to 'rotord')
-rw-r--r--rotord/src/rendercontext.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp
index 63e6f4c..57d661f 100644
--- a/rotord/src/rendercontext.cpp
+++ b/rotord/src/rendercontext.cpp
@@ -70,7 +70,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
if (command.commands[1]=="resolution") {
if (command.method=="PUT") {
if (command.body!="") {
- if (state==IDLE) {
+ if (state=!RENDERING) {
Poco::StringTokenizer t1(command.body,",");
if (t1.count()>1){
int w=ofToInt(t1[0]);
@@ -216,6 +216,10 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
}
}
}
+ else {
+ logger.error("ERROR: Session busy");
+ XML.addValue("error","Session busy");
+ }
}
}
if (command.method=="DELETE") {
@@ -260,7 +264,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
if (command.commands[1]=="video") {
if (command.method=="PUT") { //get vide file location and initiate analysis
if (command.body!="") { //there should be a filename + a destination node
- //if (state==IDLE) {
+ if (state=!RENDERING) {
string video_filename=media_dir+command.body;
//check file exists
Poco::File f=Poco::File(video_filename);
@@ -283,12 +287,12 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
logger.error("ERROR: "+command.body+" not found");
XML.addValue("error",command.body+" not found");
}
- //}
- //else {
- // status=HTTPResponse::HTTP_BAD_REQUEST;
- // logger.error("ERROR: Session busy");
- // XML.addValue("error","Session busy");
- //}
+ }
+ else {
+ status=HTTPResponse::HTTP_BAD_REQUEST;
+ logger.error("ERROR: Session busy");
+ XML.addValue("error","Session busy");
+ }
}
else {
status=HTTPResponse::HTTP_BAD_REQUEST;
@@ -304,7 +308,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
}
if (command.commands[1]=="preview") {
if (command.method=="GET") {
- if(state==IDLE){
+ if(state=!RENDERING){
//parse json to get preview spec, return XML? this is a mess
string preview_node=command.commands[2];
Json::Value root; // will contains the root value after parsing.
@@ -345,7 +349,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
}
if (command.commands[1]=="features") {
if (command.method=="GET") {
- if(state==IDLE){
+ if(state=!RENDERING){
//parse json to get preview spec, return XML? this is a mess
string features_node=command.commands[2];
if (graph.print_features(XML,features_node)) {