Plumb connection limit to proxy and output it (#384)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-20 16:28:00 -04:00
1 parent 7db0e2a5ed
commit f7e48ec836
9 files changed
+149 -59

No files matched your search

+4 -2
View File
@@ -110,7 +110,8 @@ func (w *Worker) handleProxy() http.HandlerFunc {
}
var ci *connInfo
ci, err = w.authorizeConnection(r.Context(), sessionId)
var connsLeft int32
ci, connsLeft, err = w.authorizeConnection(r.Context(), sessionId)
if err != nil {
w.logger.Error("unable to authorize conneciton", "error", err)
conn.Close(websocket.StatusInternalError, "unable to authorize connection")
@@ -127,7 +128,8 @@ func (w *Worker) handleProxy() http.HandlerFunc {
w.logger.Trace("authorized connection", "connection_id", ci.id)
handshakeResult := &proxy.HandshakeResult{
Expiration: expiration,
Expiration: expiration,
ConnectionsLeft: connsLeft,
}
if err := wspb.Write(connCtx, conn, handshakeResult); err != nil {
w.logger.Error("error sending handshake result to client", "error", err)