aboutsummaryrefslogtreecommitdiff
path: root/handle.go
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2019-03-24 22:21:08 +0200
committerMarin Ivanov <[email protected]>2019-03-24 22:21:08 +0200
commitc9585c36afe0c502c91e5ad527af1c71a80feb0a (patch)
tree3a8adf46ced72bea7410ed377c116af4330f6883 /handle.go
parent6ab1613157a6a5d3eabf9d2fe2adf4699d29a5ba (diff)
Add Makefile and configurable delay
Diffstat (limited to 'handle.go')
-rw-r--r--handle.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/handle.go b/handle.go
index 622b68e..918f3a8 100644
--- a/handle.go
+++ b/handle.go
@@ -6,7 +6,8 @@ import (
"time"
)
-type protoHandler func(net.Conn)
+type empty struct{}
+type protoHandler func(net.Conn, time.Duration)
func protocolHandler(proto string) (protoHandler, error) {
switch proto {
@@ -22,10 +23,10 @@ func logConn(conn net.Conn, msg string) {
fmt.Printf("%s, %s, %s\n", now.String(), conn.RemoteAddr().String(), msg)
}
-func connHandler(handler protoHandler, conn net.Conn) {
+func connHandler(handler protoHandler, conn net.Conn, delay time.Duration) {
defer conn.Close()
logConn(conn, "handling")
- handler(conn)
+ handler(conn, delay)
logConn(conn, "closing")
}