Procházet zdrojové kódy

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 před 2 roky
rodič
revize
89e8074c06
1 změnil soubory, kde provedl 5 přidání a 0 odebrání
  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 {