mirror of https://github.com/status-im/consul.git
consul: Remove RPC client tracking. Fixes #149.
This commit is contained in:
parent
a40cd2fd2a
commit
03a98ed1d7
|
@ -51,11 +51,6 @@ func (s *Server) listen() {
|
|||
continue
|
||||
}
|
||||
|
||||
// Track this client
|
||||
s.rpcClientLock.Lock()
|
||||
s.rpcClients[conn] = struct{}{}
|
||||
s.rpcClientLock.Unlock()
|
||||
|
||||
go s.handleConn(conn, false)
|
||||
metrics.IncrCounter([]string{"consul", "rpc", "accept_conn"}, 1)
|
||||
}
|
||||
|
@ -125,13 +120,7 @@ func (s *Server) handleMultiplex(conn net.Conn) {
|
|||
|
||||
// handleConsulConn is used to service a single Consul RPC connection
|
||||
func (s *Server) handleConsulConn(conn net.Conn) {
|
||||
defer func() {
|
||||
conn.Close()
|
||||
s.rpcClientLock.Lock()
|
||||
delete(s.rpcClients, conn)
|
||||
s.rpcClientLock.Unlock()
|
||||
}()
|
||||
|
||||
defer conn.Close()
|
||||
rpcCodec := codec.GoRpc.ServerCodec(conn, &codec.MsgpackHandle{})
|
||||
for !s.shutdown {
|
||||
if err := s.rpcServer.ServeRequest(rpcCodec); err != nil {
|
||||
|
|
|
@ -81,10 +81,6 @@ type Server struct {
|
|||
remoteConsuls map[string][]net.Addr
|
||||
remoteLock sync.RWMutex
|
||||
|
||||
// rpcClients is used to track active clients
|
||||
rpcClients map[net.Conn]struct{}
|
||||
rpcClientLock sync.Mutex
|
||||
|
||||
// rpcListener is used to listen for incoming connections
|
||||
rpcListener net.Listener
|
||||
rpcServer *rpc.Server
|
||||
|
@ -160,7 +156,6 @@ func NewServer(config *Config) (*Server, error) {
|
|||
logger: logger,
|
||||
reconcileCh: make(chan serf.Member, 32),
|
||||
remoteConsuls: make(map[string][]net.Addr),
|
||||
rpcClients: make(map[net.Conn]struct{}),
|
||||
rpcServer: rpc.NewServer(),
|
||||
rpcTLS: incomingTLS,
|
||||
shutdownCh: make(chan struct{}),
|
||||
|
@ -392,13 +387,6 @@ func (s *Server) Shutdown() error {
|
|||
s.rpcListener.Close()
|
||||
}
|
||||
|
||||
// Close all the RPC connections
|
||||
s.rpcClientLock.Lock()
|
||||
for conn := range s.rpcClients {
|
||||
conn.Close()
|
||||
}
|
||||
s.rpcClientLock.Unlock()
|
||||
|
||||
// Close the connection pool
|
||||
s.connPool.Shutdown()
|
||||
|
||||
|
|
Loading…
Reference in New Issue