HasBufferedData safely checks if the connection has buffered data. This method is used to avoid data races when checking for push notifications.
()
| 852 | // HasBufferedData safely checks if the connection has buffered data. |
| 853 | // This method is used to avoid data races when checking for push notifications. |
| 854 | func (cn *Conn) HasBufferedData() bool { |
| 855 | // Use read lock for concurrent access to reader state |
| 856 | cn.readerMu.RLock() |
| 857 | defer cn.readerMu.RUnlock() |
| 858 | return cn.rd.Buffered() > 0 |
| 859 | } |
| 860 | |
| 861 | // PeekReplyTypeSafe safely peeks at the reply type. |
| 862 | // This method is used to avoid data races when checking for push notifications. |