Переглянути джерело

Add AcceptBacklog function

This will return the number of streams ready to be accepted. It can be
useful to export this value as a metric.
Manish Tomar 2 роки тому
батько
коміт
89e8074c06
1 змінених файлів з 5 додано та 0 видалено
  1. 5 0
      session.go

+ 5 - 0
session.go

@@ -250,6 +250,11 @@ func (s *Session) AcceptStream() (*Stream, error) {
 	}
 }
 
+// AcceptBacklog returns the number of streams waiting to be "Accept"ed.
+func (s *Session) AcceptBacklog() int {
+	return len(s.acceptCh)
+}
+
 // Close is used to close the session and all streams.
 // Attempts to send a GoAway before closing the connection.
 func (s *Session) Close() error {