Преглед изворни кода

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 {