X-Git-Url: http://git.pjr.cc/?p=goDBhammer.git;a=blobdiff_plain;f=src%2Fwebconnector.go;h=80a333f22ebc0f7cab5d3dc1ee2e3a015fe62d83;hp=9885bbb1e3a6b2b2c612771efbd66185eaa38301;hb=4644c6698a7b6ce6fdb913c2efd170cba3ebec16;hpb=c9e1d3b61ac854f6ca704d627957241a725d4bc2 diff --git a/src/webconnector.go b/src/webconnector.go index 9885bbb..80a333f 100644 --- a/src/webconnector.go +++ b/src/webconnector.go @@ -11,8 +11,8 @@ import ( "fmt"; ) -var comin chan int; -var comout chan int; +var comin chan string; +var comout chan string; // hello world, the web server func ServerResponder(c *http.Conn, req *http.Request) { @@ -27,12 +27,30 @@ func ServerResponder(c *http.Conn, req *http.Request) { if req.RawURL == "/confirm" { confirmPage(c, req); } + + if req.RawURL == "/begin" { + beginPage(c, req); + } - // fucking go, i just wanna consume the incoming data, but it forces me to do something with it... cunt of a language //k := <- comin; //fmt.Printf("%d\n", k); } +func beginPage(c *http.Conn, req *http.Request) +{ + header(c); + io.WriteString(c, "

Starting hammer

"); + //dbhost := req.FormValue("dbhost"); + //dbuser := req.FormValue("dbuser"); + //dbpass := req.FormValue("dbpass"); + //dbname := req.FormValue("dbname"); + //nthreads := req.FormValue("nthreads"); + //dbmult := req.FormValue("dbmult"); + + footer(c); + +} + func confirmPage(c *http.Conn, req *http.Request) { header(c); @@ -64,6 +82,8 @@ func confirmPage(c *http.Conn, req *http.Request) io.WriteString(c, ""); footer(c); + comout <- fmt.Sprintf("configure:%s:%s:%s:%s:%s:%s", dbhost, dbuser, dbpass, dbname, dbmult, nthreads); + } func mainPage(c *http.Conn, req *http.Request) @@ -98,14 +118,14 @@ func footer(c *http.Conn) func main() { - comin = make(chan int); - comout = make(chan int); + comin = make(chan string); + comout = make(chan string); bc := benchcontroller.CreateController(); go benchcontroller.MainLoop(bc, comout, comin); http.Handle("/", http.HandlerFunc(ServerResponder)); - err := http.ListenAndServe(":12345", nil); + err := http.ListenAndServe(":22222", nil); if err != nil { panic("ListenAndServe: ", err.String()) }