Fix call number, we don't really care much about them

This commit is contained in:
Mustafa Gezen 2024-12-25 15:27:23 +01:00
parent 05539bd40b
commit ecd9adf07e
3 changed files with 7 additions and 8 deletions

View file

@ -4,7 +4,6 @@ import (
"bytes"
"context"
"encoding/xml"
"fmt"
"io"
"log/slog"
"net/http"
@ -124,7 +123,7 @@ func xmlRpcHandlerWrapper[Req any, Res any](handler func(context.Context, *Req)
return
}
fmt.Println(buf.String())
//fmt.Println(buf.String())
w.Header().Set("Content-Type", "text/xml")
w.WriteHeader(http.StatusOK)

View file

@ -81,7 +81,7 @@ We might skip some features that are rarely needed or just not useful for Rocky
* [ ] filterResults(methodName, *args, **kw)
* [ ] findBuildID(X, strict=False)
* [ ] freeTask(task_id)
* [ ] getAPIVersion()
* [x] getAPIVersion()
* [ ] getActiveRepos()
* [ ] getAllArches()
* [ ] getAllPerms()
@ -113,7 +113,7 @@ We might skip some features that are rarely needed or just not useful for Rocky
* [ ] getImageArchive(archive_id, strict=False)
* [ ] getImageBuild(buildInfo, strict=False)
* [ ] getInheritanceData(tag, event=None)
* [ ] getKojiVersion()
* [x] getKojiVersion()
* [ ] getLastEvent(before=None, strict=True)
* [ ] getLastHostUpdate(hostID, ts=False)
* [ ] getLatestBuilds(tag, event=None, package=None, type=None, draft=None)
@ -305,7 +305,7 @@ We might skip some features that are rarely needed or just not useful for Rocky
* [ ] showSession()
* [ ] snapshotTag(src, dst, config=True, pkgs=True, builds=True, groups=True, latest_only=True, inherit_builds=True, event=None, force=False)
* [ ] snapshotTagModify(src, dst, config=True, pkgs=True, builds=True, groups=True, latest_only=True, inherit_builds=True, event=None, force=False, remove=False)
* [ ] sslLogin(*args, **opts)
* [x] sslLogin(*args, **opts)
* [ ] subsession()
* [ ] system.listMethods()
* [ ] system.methodHelp(method)

View file

@ -53,12 +53,12 @@ func (s *Server) sessionAuthInterceptor(next InterceptorFunc) InterceptorFunc {
if err != nil {
return nil, status.Error(codes.Internal, "Invalid call number")
}
if session.CallNum != callNumInt {
return nil, status.Error(codes.Internal, "Invalid call number")
if session.CallNum > callNumInt {
return nil, status.Error(codes.Internal, "Call number mismatch")
}
// Increase call number
session.CallNum++
session.CallNum = callNumInt + 1
err = Q[Session](s.db).Ux(ctx, session)
if err != nil {
slog.Error("Error updating session", "error", err)