aboutsummaryrefslogtreecommitdiff
path: root/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'http.go')
-rw-r--r--http.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/http.go b/http.go
index 6abac6d..b5982e8 100644
--- a/http.go
+++ b/http.go
@@ -37,12 +37,13 @@ func httpHandler(conn net.Conn, delay time.Duration) {
io.Copy(ioutil.Discard, conn)
}()
- tick := time.Tick(delay)
+ ticker := time.NewTicker(delay)
+ defer ticker.Stop()
for {
select {
case <-eof:
return
- case <-tick:
+ case <-ticker.C:
_, err := fmt.Fprintf(conn, "X-%0x: %0x\r\n", rand.Uint32(), rand.Uint32())
if err != nil {
return