IsValid returns a boolean indicating whether the subscription is still active. This will return false if the subscription has already been closed.
()
| 5044 | // is still active. This will return false if the subscription has |
| 5045 | // already been closed. |
| 5046 | func (s *Subscription) IsValid() bool { |
| 5047 | if s == nil { |
| 5048 | return false |
| 5049 | } |
| 5050 | s.mu.Lock() |
| 5051 | defer s.mu.Unlock() |
| 5052 | return s.conn != nil && !s.closed |
| 5053 | } |
| 5054 | |
| 5055 | // Drain will remove interest but continue callbacks until all messages |
| 5056 | // have been processed. |
no outgoing calls