X-Git-Url: http://git.pjr.cc/?p=goDBhammer.git;a=blobdiff_plain;f=src%2Fwebconnector.go;fp=src%2Fwebconnector.go;h=c64e0bd9ea9377a3e7431d23999391b025d3fb25;hp=eb81cc0907f3a517c37a6c7a763464f10984880f;hb=bef84ec5fda392a2025be99354dd93f32c686a41;hpb=2fa101f3b4d4aedc0fdc35c64cdfb63beadea3d2 diff --git a/src/webconnector.go b/src/webconnector.go index eb81cc0..c64e0bd 100644 --- a/src/webconnector.go +++ b/src/webconnector.go @@ -6,27 +6,44 @@ package main import ( "http"; "io"; - "./dbibridge"; + //"./dbibridge"; + "./benchcontroller"; + "fmt"; ) +var comin chan int; +var comout chan int; + // hello world, the web server func HelloServer(c *http.Conn, req *http.Request) { + comout <- 1; io.WriteString(c, "
\n"); + + // 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 main() { - var Dbconn *dbibridge.DBIConnection; + //var Dbconn *dbibridge.DBIConnection; + + //Dbconn = dbibridge.DBICreate(); + + //dbibridge.DBIConnect(Dbconn, "mysql", "localhost", "root", "password", "zm"); + //dbibridge.ExecSQL(Dbconn, "create table asdf (asdf int)"); + //dbibridge.DBIDisconnect(Dbconn); + + comin = make(chan int); + comout = make(chan int); - Dbconn = dbibridge.DBICreate(); + bc := benchcontroller.CreateController(); + go benchcontroller.MainLoop(bc, comout, comin); - dbibridge.DBIConnect(Dbconn, "mysql", "localhost", "root", "password", "zm"); - dbibridge.ExecSQL(Dbconn, "create table asdf (asdf int)"); - dbibridge.DBIDisconnect(Dbconn); - //http.Handle("/hello", http.HandlerFunc(HelloServer)); - //err := http.ListenAndServe(":12345", nil); - //if err != nil { - ////panic("ListenAndServe: ", err.String()) - //} + http.Handle("/hello", http.HandlerFunc(HelloServer)); + err := http.ListenAndServe(":12345", nil); + if err != nil { + panic("ListenAndServe: ", err.String()) + } }