MCPcopy Index your code
hub / github.com/koding/kite / Close

Method Close

client.go:543–569  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

541}
542
543func (c *Client) Close() {
544 if !atomic.CompareAndSwapInt32(&c.closed, 0, 1) {
545 return // TODO: ErrAlreadyClosed
546 }
547
548 c.muReconnect.Lock()
549 // TODO(rjeczalik): add another internal field for controlling redials
550 // instead of mutating public field
551 c.Reconnect = false
552 c.muReconnect.Unlock()
553
554 close(c.closeChan)
555
556 if c.closeRenewer != nil {
557 select {
558 case c.closeRenewer <- struct{}{}:
559 default:
560 }
561 }
562
563 // wait for consumers to finish buffered messages
564 c.wg.Wait()
565
566 if session := c.getSession(); session != nil {
567 session.Close(3000, "Go away!")
568 }
569}
570
571// sendhub sends the msg received from the send channel to the remote client
572func (c *Client) sendHub() {

Callers 7

TestContextFunction · 0.95
TestMultipleFunction · 0.95
TestSendErrorFunction · 0.95
TestConcurrencyFunction · 0.95
TestKiteFunction · 0.95
sockjsHandlerMethod · 0.95

Calls 1

getSessionMethod · 0.95

Tested by 6

TestContextFunction · 0.76
TestMultipleFunction · 0.76
TestSendErrorFunction · 0.76
TestConcurrencyFunction · 0.76
TestKiteFunction · 0.76