Last active
March 23, 2016 12:43
-
-
Save darasion/30ea7cb5a90750ef9627 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
"log" | |
"net/http" | |
) | |
type MyHandler struct {} | |
func (*MyHandler)ServeHTTP(http.ResponseWriter, *http.Request) { | |
fmt.Println("aaaa") | |
} | |
func main() { | |
s := &http.Server{ | |
Addr: ":8989", | |
Handler: &MyHandler{}, | |
ReadTimeout: 10 * time.Second, | |
WriteTimeout: 10 * time.Second, | |
MaxHeaderBytes: 1 << 20, | |
} | |
go func() { | |
for { | |
time.Sleep(time.Millisecond) | |
s.ReadTimeout = time.Second | |
} | |
}() | |
log.Fatal(s.ListenAndServe()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment