aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2020-02-04 05:16:58 +0200
committerMarin Ivanov <[email protected]>2020-02-04 05:16:58 +0200
commita706f7ec5eeb19761ef482e86113c258fb4c2a7c (patch)
tree594bf3fa0656e136286c60a6fde3d11306610fd5
parentd1ffcbf7d26b7a52cfe68469fc5619ae3e1dac44 (diff)
close chan semaphores, instead
-rw-r--r--http.go2
-rw-r--r--ssh.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/http.go b/http.go
index cf665b4..6abac6d 100644
--- a/http.go
+++ b/http.go
@@ -33,8 +33,8 @@ func httpHandler(conn net.Conn, delay time.Duration) {
eof := make(chan empty)
go func() {
+ close(eof)
io.Copy(ioutil.Discard, conn)
- eof <- empty{}
}()
tick := time.Tick(delay)
diff --git a/ssh.go b/ssh.go
index 909dc13..cced23e 100644
--- a/ssh.go
+++ b/ssh.go
@@ -12,8 +12,8 @@ import (
func sshHandler(conn net.Conn, delay time.Duration) {
eof := make(chan empty)
go func() {
+ defer close(eof)
io.Copy(ioutil.Discard, conn)
- eof <- empty{}
}()
tick := time.Tick(delay)