From ebf984b6b7ec855363f60bdb147e827d0737a5cb Mon Sep 17 00:00:00 2001 From: brl Date: Sun, 7 Jun 2015 15:59:33 -0400 Subject: [PATCH] add MsgServer.Close() method --- ipc/ipc.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ipc/ipc.go b/ipc/ipc.go index 72555a9..d6bfbad 100644 --- a/ipc/ipc.go +++ b/ipc/ipc.go @@ -64,8 +64,6 @@ func (s *MsgServer) Run() error { for { conn, err := s.listener.AcceptUnix() if err != nil { - s.disp.close() - s.listener.Close() return err } if err := setPassCred(conn); err != nil { @@ -84,6 +82,12 @@ func (s *MsgServer) Run() error { return nil } +func (s *MsgServer) Close() error { + s.disp.close() + close(s.done) + return s.listener.Close() +} + func Connect(address string, factory MsgFactory, log *logging.Logger, handlers ...interface{}) (*MsgConn, error) { md, err := createDispatcher(log, handlers...) if err != nil {