Fixing build issues

This commit is contained in:
MichaelOultram 2015-07-30 15:34:40 +01:00
parent a55ce8a3e0
commit f15ff8755a
2 changed files with 15 additions and 14 deletions

View file

@ -244,7 +244,8 @@ func main() {
os.Exit(1) os.Exit(1)
} }
web = makeWebserver(9563) web = NewWebServer(9563)
web.makeWeb()
if isNil(web) { if isNil(web) {
Verbose("WEB IS NIL") Verbose("WEB IS NIL")

26
web.go
View file

@ -27,21 +27,21 @@ type Page struct {
var external_ip = "" var external_ip = ""
func makeWebserver(port int) *WebServer { func NewWebServer(port int) *WebServer {
webserver := &WebServer{} return &WebServer{
port: port,
webserver.port = port client_token: make(map[*gumble.User]string),
webserver.client_token = make(map[*gumble.User]string) token_client: make(map[string]*gumble.User),
webserver.token_client = make(map[string]*gumble.User) }
}
http.HandleFunc("/", webserver.homepage)
http.HandleFunc("/add", webserver.add)
http.HandleFunc("/volume", webserver.volume)
http.HandleFunc("/skip", webserver.skip)
http.ListenAndServe(":"+strconv.Itoa(port), nil)
func (web *WebServer) makeWeb() {
http.HandleFunc("/", web.homepage)
http.HandleFunc("/add", web.add)
http.HandleFunc("/volume", web.volume)
http.HandleFunc("/skip", web.skip)
http.ListenAndServe(":"+strconv.Itoa(web.port), nil)
rand.Seed(time.Now().UnixNano()) rand.Seed(time.Now().UnixNano())
return webserver
} }
func (web *WebServer) homepage(w http.ResponseWriter, r *http.Request) { func (web *WebServer) homepage(w http.ResponseWriter, r *http.Request) {