More cleanup

pull/23/head
maru 6 months ago
parent c76746ad35
commit 476e667572
No known key found for this signature in database
GPG Key ID: 37689350E9CD0F0D

@ -219,21 +219,23 @@ func UpdateTrainerIds(trainerId, secretId int, uuid []byte) error {
return nil
}
func IsActiveSession(uuid []byte, clientSessionId string) (bool, error) {
var storedId string
err := handle.QueryRow("SELECT clientSessionId FROM activeClientSessions WHERE uuid = ?", uuid).Scan(&storedId)
func IsActiveSession(uuid []byte, sessionId string) (bool, error) {
var id string
err := handle.QueryRow("SELECT clientSessionId FROM activeClientSessions WHERE uuid = ?", uuid).Scan(&id)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
err = UpdateActiveSession(uuid, clientSessionId)
err = UpdateActiveSession(uuid, sessionId)
if err != nil {
return false, err
}
return true, nil
}
return false, err
}
return storedId == "" || storedId == clientSessionId, nil
return id == "" || id == sessionId, nil
}
func UpdateActiveSession(uuid []byte, clientSessionId string) error {

Loading…
Cancel
Save