Get rid of Server.downstreamConns
This is unused right now. Let's remove it, we'll add it back if we really need it.
This commit is contained in:
parent
8c56e610ff
commit
551d41335e
14
server.go
14
server.go
@ -57,7 +57,6 @@ type Server struct {
|
||||
|
||||
lock sync.Mutex
|
||||
users map[string]*user
|
||||
downstreamConns []*downstreamConn
|
||||
}
|
||||
|
||||
func NewServer(db *DB) *Server {
|
||||
@ -112,10 +111,6 @@ func (s *Server) Serve(ln net.Listener) error {
|
||||
dc := newDownstreamConn(s, netConn, nextDownstreamID)
|
||||
nextDownstreamID++
|
||||
go func() {
|
||||
s.lock.Lock()
|
||||
s.downstreamConns = append(s.downstreamConns, dc)
|
||||
s.lock.Unlock()
|
||||
|
||||
if err := dc.runUntilRegistered(); err != nil {
|
||||
dc.logger.Print(err)
|
||||
} else {
|
||||
@ -126,15 +121,6 @@ func (s *Server) Serve(ln net.Listener) error {
|
||||
dc.user.events <- eventDownstreamDisconnected{dc}
|
||||
}
|
||||
dc.Close()
|
||||
|
||||
s.lock.Lock()
|
||||
for i := range s.downstreamConns {
|
||||
if s.downstreamConns[i] == dc {
|
||||
s.downstreamConns = append(s.downstreamConns[:i], s.downstreamConns[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
s.lock.Unlock()
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user