mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-15 03:30:39 +03:00
Add more broker log
This commit is contained in:
parent
8b2a550368
commit
1c7f859b5e
@ -69,10 +69,11 @@ func (broker *broker) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||||||
// Make sure that the writer supports flushing.
|
// Make sure that the writer supports flushing.
|
||||||
flusher, ok := rw.(http.Flusher)
|
flusher, ok := rw.(http.Flusher)
|
||||||
|
|
||||||
username, _ := request.UsernameFrom(req.Context())
|
fmt.Printf("%#v\n", req.Context())
|
||||||
|
user, _ := request.UserFrom(req.Context())
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Error(rw, "Streaming unsupported! Events cannot be sent to this client", "address", req.RemoteAddr,
|
log.Error(rw, "Streaming unsupported! Events cannot be sent to this client", "address", req.RemoteAddr,
|
||||||
"userAgent", req.UserAgent(), "user", username)
|
"userAgent", req.UserAgent(), "user", user.UserName)
|
||||||
http.Error(rw, "Streaming unsupported!", http.StatusInternalServerError)
|
http.Error(rw, "Streaming unsupported!", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -88,6 +89,9 @@ func (broker *broker) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
|||||||
// Signal the broker that we have a new connection
|
// Signal the broker that we have a new connection
|
||||||
broker.newClients <- messageChan
|
broker.newClients <- messageChan
|
||||||
|
|
||||||
|
log.Debug(req.Context(), "New broker client", "address", req.RemoteAddr, "userAgent", req.UserAgent(),
|
||||||
|
"user", user.UserName)
|
||||||
|
|
||||||
// Remove this client from the map of connected clients
|
// Remove this client from the map of connected clients
|
||||||
// when this handler exits.
|
// when this handler exits.
|
||||||
defer func() {
|
defer func() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user