Ver código fonte

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 anos atrás
pai
commit
89e8074c06
1 arquivos alterados com 5 adições e 0 exclusões
  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 {