Закрытие сокета после неуспешного handshake
This commit is contained in:
@@ -82,12 +82,14 @@ func processData(data <-chan []byte, connection *Connection) {
|
||||
}
|
||||
connection.Socket.WriteMessage(websocket.BinaryMessage, []byte{0xFF})
|
||||
logger.LogWarnMessage("failed handshake from " + connection.Socket.RemoteAddr().String() + " because of invalid secret key")
|
||||
connection.Socket.Close()
|
||||
return
|
||||
}
|
||||
|
||||
// Так как следующие пакеты требуют обязательного завершения рукопожатия, нужно проверять, что сокет уже прошел рукопожатие
|
||||
if _, exists := GetSocket(connection.Identificator); !exists {
|
||||
logger.LogWarnMessage("received data from " + connection.Socket.RemoteAddr().String() + " but it has not completed handshake")
|
||||
connection.Socket.Close()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user