diff options
| author | Marin Ivanov <[email protected]> | 2019-03-24 22:21:08 +0200 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2019-03-24 22:21:08 +0200 |
| commit | c9585c36afe0c502c91e5ad527af1c71a80feb0a (patch) | |
| tree | 3a8adf46ced72bea7410ed377c116af4330f6883 /handle.go | |
| parent | 6ab1613157a6a5d3eabf9d2fe2adf4699d29a5ba (diff) | |
Add Makefile and configurable delay
Diffstat (limited to 'handle.go')
| -rw-r--r-- | handle.go | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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") } |
