conn.go
func (c *Conn) Wait(timeout int) error {
	done := make(chan bool)

	go func() { c.wg.Wait(); done <- true }()

	select {
	case <-done:
		return nil
	case <-time.After(time.Second * time.Duration(timeout)):
		return errors.New("wait timed out")
	}
}
func (c *Conn) Wait(timeout int) error {
	done := make(chan bool)

	go func() { c.wg.Wait(); done <- true }()

	select {
	case <-done:
		return nil
	case <-time.After(time.Second * time.Duration(timeout)):
		return errors.New("wait timed out")
	}
}
func ( c * Conn ) Wait ( timeout int ) error { done := make ( chan bool ) go func ( ) { c . wg . Wait ( ) ; done <- true } ( ) select { case <- done : return nil case <- time . After ( time . Second * time . Duration ( timeout ) ) : return errors . New ( " " ) } }
// Wait waits for all message/connection handler goroutines to exit.
// Returns error if wait timeouts (in seconds).
Wait waits for all message / connection handler goroutines to exit . Returns error if wait timeouts ( in seconds ) .