From 40422f2d22d08380b8592c628cdbd3d9481d36be Mon Sep 17 00:00:00 2001 From: crusader Date: Tue, 10 Apr 2018 13:02:00 +0900 Subject: [PATCH] ing --- connection-handler.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/connection-handler.go b/connection-handler.go index 0bb116e..51e6119 100644 --- a/connection-handler.go +++ b/connection-handler.go @@ -2,7 +2,6 @@ package server import ( "crypto/tls" - "fmt" "net" "time" ) @@ -20,16 +19,21 @@ type ConnectionHandlers struct { // The maximum number of concurrent connections the server may serve. // // DefaultConcurrency is used if not set. - Network string `json:"network"` - Address string `json:"address"` - Concurrency int `json:"concurrency"` - KeepAlive time.Duration `json:"keepAlive"` - HandshakeTimeout time.Duration `json:"handshakeTimeout"` + Network string `json:"network"` + Address string `json:"address"` + Concurrency int `json:"concurrency"` + KeepAlive time.Duration `json:"keepAlive"` + HandshakeTimeout time.Duration `json:"handshakeTimeout"` TLSConfig *tls.Config } func (ch *ConnectionHandlers) Listener(serverCtx ServerCtx) (net.Listener, error) { - return nil, fmt.Errorf("Method[ConnectionHandler.Listener] is not implemented") + l, err := net.Listen(ch.Network, ch.Address) + if nil != err { + return nil, err + } + + return l, nil } func (ch *ConnectionHandlers) GetConcurrency() int {