fix for nil channel

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
This commit is contained in:
Василий Толстов 2017-07-10 23:20:56 +03:00
parent a9b36a4d3a
commit 7915e89e38

View File

@ -244,7 +244,9 @@ func Serve(ctx context.Context, ln net.Listener, cfg *ServerConfig) error {
handlerLoop:
for _, h := range cfg.Handlers {
if err := h.Handle(conn); err != nil {
if cfg.ErrorCh != nil {
cfg.ErrorCh <- err
}
conn.Close()
break handlerLoop
}