More cleanup

pull/23/head
maru 7 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 return nil
} }
func IsActiveSession(uuid []byte, clientSessionId string) (bool, error) { func IsActiveSession(uuid []byte, sessionId string) (bool, error) {
var storedId string var id string
err := handle.QueryRow("SELECT clientSessionId FROM activeClientSessions WHERE uuid = ?", uuid).Scan(&storedId) err := handle.QueryRow("SELECT clientSessionId FROM activeClientSessions WHERE uuid = ?", uuid).Scan(&id)
if err != nil { if err != nil {
if errors.Is(err, sql.ErrNoRows) { if errors.Is(err, sql.ErrNoRows) {
err = UpdateActiveSession(uuid, clientSessionId) err = UpdateActiveSession(uuid, sessionId)
if err != nil { if err != nil {
return false, err return false, err
} }
return true, nil return true, nil
} }
return false, err return false, err
} }
return storedId == "" || storedId == clientSessionId, nil return id == "" || id == sessionId, nil
} }
func UpdateActiveSession(uuid []byte, clientSessionId string) error { func UpdateActiveSession(uuid []byte, clientSessionId string) error {

Loading…
Cancel
Save