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)
}
web = makeWebserver(9563)
web = NewWebServer(9563)
web.makeWeb()
if isNil(web) {
Verbose("WEB IS NIL")

26
web.go
View file

@ -27,21 +27,21 @@ type Page struct {
var external_ip = ""
func makeWebserver(port int) *WebServer {
webserver := &WebServer{}
webserver.port = port
webserver.client_token = make(map[*gumble.User]string)
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 NewWebServer(port int) *WebServer {
return &WebServer{
port: port,
client_token: make(map[*gumble.User]string),
token_client: make(map[string]*gumble.User),
}
}
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())
return webserver
}
func (web *WebServer) homepage(w http.ResponseWriter, r *http.Request) {