|
|
@@ -1,14 +1,15 @@
|
|
|
package main
|
|
|
|
|
|
import (
|
|
|
- "fmt"
|
|
|
- "net"
|
|
|
- "golang.org/x/net/netutil"
|
|
|
"battlecamp-go-server/board"
|
|
|
+ "fmt"
|
|
|
"log"
|
|
|
+ "net"
|
|
|
"net/http"
|
|
|
"os"
|
|
|
"strconv"
|
|
|
+
|
|
|
+ "golang.org/x/net/netutil"
|
|
|
)
|
|
|
|
|
|
func main() {
|
|
|
@@ -22,7 +23,7 @@ func main() {
|
|
|
log.Printf("%v=n", err)
|
|
|
}
|
|
|
|
|
|
- http.HandleFunc("/", generateBoard)
|
|
|
+ http.HandleFunc("/", gzipHandler(generateBoard))
|
|
|
http.HandleFunc("/status", status)
|
|
|
l, _ := net.Listen("tcp", ":8081")
|
|
|
limitListerer := netutil.LimitListener(l, 100)
|
|
|
@@ -36,7 +37,7 @@ func generateBoard(w http.ResponseWriter, r *http.Request) {
|
|
|
height, _ := strconv.Atoi(r.FormValue("height"))
|
|
|
totalWidth, _ := strconv.Atoi(r.FormValue("totalWidth"))
|
|
|
totalHeight, _ := strconv.Atoi(r.FormValue("totalHeight"))
|
|
|
- log.Printf("Creating partial x=%v, y=%v, width=%v, height=%v, totalWidth=%v, totalHeight=%v", x, y, width, height, totalWidth, totalHeight)
|
|
|
+ //log.Printf("Creating partial x=%v, y=%v, width=%v, height=%v, totalWidth=%v, totalHeight=%v", x, y, width, height, totalWidth, totalHeight)
|
|
|
b := board.NewRegion(x, y, width, height, totalWidth, totalHeight)
|
|
|
b.WriteData(w)
|
|
|
}
|