var cominstatus chan string;
var comout chan string;
+var stat int;
+
func JSONResponder(c *http.Conn, req *http.Request)
{
//stat := <- cominstatus;
if(req.Method == "GET") {
- j, _, _ := json.StringToJson("{\"status\":1, \"complete\":90}");
+ j, _, _ := json.StringToJson(fmt.Sprintf("{\"status\":%d, \"complete\":90}", stat));
io.WriteString(c, fmt.Sprintf("%s\n", json.JsonToString(j)));
fmt.Printf("i got a get\n");
lp := make([]byte, 1048576);
req.Body.Read(lp);
fmt.Printf("i got a post...%s\n", (string)(lp));
- http.Redirect(c, "/", 301);
+ //http.Redirect(c, "/", 301);
+ stat = 2;
}
}
cominstatus = make(chan string);
comout = make(chan string);
+ stat = 1;
bc := benchcontroller.CreateController();
go benchcontroller.MainLoop(bc, comout, comin, cominstatus);