Send hello response through session.

This commit is contained in:
Joachim Bauch 2021-06-01 09:52:19 +02:00
parent 6e54d8f4f4
commit 0b2df54343
No known key found for this signature in database
GPG Key ID: 77C1D22D53E15F02
1 changed files with 4 additions and 4 deletions

8
hub.go
View File

@ -740,7 +740,7 @@ func (h *Hub) processRegister(client *Client, message *ClientMessage, backend *B
h.setDecodedSessionId(privateSessionId, privateSessionName, sessionIdData)
h.setDecodedSessionId(publicSessionId, publicSessionName, sessionIdData)
h.sendHelloResponse(client, message, session)
h.sendHelloResponse(session, message)
}
func (h *Hub) processUnregister(client *Client) *ClientSession {
@ -816,7 +816,7 @@ func (h *Hub) processMessage(client *Client, data []byte) {
}
}
func (h *Hub) sendHelloResponse(client *Client, message *ClientMessage, session *ClientSession) bool {
func (h *Hub) sendHelloResponse(session *ClientSession, message *ClientMessage) bool {
response := &ServerMessage{
Id: message.Id,
Type: "hello",
@ -828,7 +828,7 @@ func (h *Hub) sendHelloResponse(client *Client, message *ClientMessage, session
Server: h.GetServerInfo(session),
},
}
return client.SendMessage(response)
return session.SendMessage(response)
}
func (h *Hub) processHello(client *Client, message *ClientMessage) {
@ -875,7 +875,7 @@ func (h *Hub) processHello(client *Client, message *ClientMessage) {
log.Printf("Resume session from %s in %s (%s) %s (private=%s)", client.RemoteAddr(), client.Country(), client.UserAgent(), session.PublicId(), session.PrivateId())
h.sendHelloResponse(client, message, clientSession)
h.sendHelloResponse(clientSession, message)
clientSession.NotifySessionResumed(client)
return
}