From 941ac256484baf44289334ad70bcc3c941b6600a Mon Sep 17 00:00:00 2001 From: fatedier Date: Fri, 10 Aug 2018 12:02:38 +0800 Subject: [PATCH] fix ci --- Gopkg.lock | 2 +- server/service.go | 4 ++-- vendor/github.com/fatedier/golib/net/mux/mux.go | 10 ++++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 80cf09e4..acff9733 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -30,7 +30,7 @@ "net/mux", "pool" ] - revision = "416571c55dbc32e13ce82c301a2a4b5a48ad7309" + revision = "280fa74053dee5311c46094f4bdefbf76d3fcbe2" [[projects]] branch = "frp" diff --git a/server/service.go b/server/service.go index 024b6835..2f93f909 100644 --- a/server/service.go +++ b/server/service.go @@ -122,8 +122,8 @@ func NewService() (svr *Service, err error) { return } - svr.muxer = mux.NewMux() - go svr.muxer.Serve(ln) + svr.muxer = mux.NewMux(ln) + go svr.muxer.Serve() ln = svr.muxer.DefaultListener() svr.listener = frpNet.WrapLogListener(ln) diff --git a/vendor/github.com/fatedier/golib/net/mux/mux.go b/vendor/github.com/fatedier/golib/net/mux/mux.go index 07eec588..296392b9 100644 --- a/vendor/github.com/fatedier/golib/net/mux/mux.go +++ b/vendor/github.com/fatedier/golib/net/mux/mux.go @@ -43,8 +43,9 @@ type Mux struct { mu sync.RWMutex } -func NewMux() (mux *Mux) { +func NewMux(ln net.Listener) (mux *Mux) { mux = &Mux{ + ln: ln, lns: make([]*listener, 0), } return @@ -123,15 +124,12 @@ func (mux *Mux) copyLns() []*listener { } // Serve handles connections from ln and multiplexes then across registered listeners. -func (mux *Mux) Serve(ln net.Listener) error { - mux.mu.Lock() - mux.ln = ln - mux.mu.Unlock() +func (mux *Mux) Serve() error { for { // Wait for the next connection. // If it returns a temporary error then simply retry. // If it returns any other error then exit immediately. - conn, err := ln.Accept() + conn, err := mux.ln.Accept() if err, ok := err.(interface { Temporary() bool }); ok && err.Temporary() {