This commit is contained in:
crusader 2017-12-01 22:10:48 +09:00
parent 81d3fff70a
commit 874dc27745
2 changed files with 5 additions and 3 deletions

View File

@ -62,7 +62,7 @@ func (c *client) Connect() error {
c.rwcHandler.Validate() c.rwcHandler.Validate()
if c.stopChan != nil { if c.stopChan != nil {
panic("RPC Client: the given client is already started. Call Client.Stop() before calling Client.Start() again!") return fmt.Errorf("RPC Client: the given client is already started. Call Client.Stop() before calling Client.Start() again")
} }
c.ctx = c.ch.ClientContext(nil) c.ctx = c.ch.ClientContext(nil)
@ -84,7 +84,8 @@ func (c *client) Connect() error {
func (c *client) Close() { func (c *client) Close() {
if c.stopChan == nil { if c.stopChan == nil {
panic("RPC Client: the client must be started before stopping it") logging.Logger().Warn("RPC Client: the client must be started before stopping it")
return
} }
c.ch.Destroy(c.ctx) c.ch.Destroy(c.ctx)

View File

@ -104,7 +104,8 @@ func (s *rpcServlet) Context() ServletContext {
func (s *rpcServlet) destroy(err error) { func (s *rpcServlet) destroy(err error) {
if s.stopChan == nil { if s.stopChan == nil {
panic("Server: server must be started before stopping it") logging.Logger().Warn("Server: server must be started before stopping it")
return
} }
close(s.stopChan) close(s.stopChan)