Skip to content

Commit 2c85d3b

Browse files
author
tommy
committed
Add more debugging
1 parent b25bfa2 commit 2c85d3b

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

addons/sourcemod/scripting/offstyledb.sp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,24 +646,31 @@ void UploadReplay(const char[] replayKey, const char[] replayPath)
646646

647647
public void OnRecordSubmitted(HTTPResponse resp, any value, const char[] error)
648648
{
649+
DebugPrint("[OSdb] OnRecordSubmitted callback fired");
650+
649651
DataPack pack = view_as<DataPack>(value);
650652
pack.Reset();
651653

652654
if (gCV_ReplayMode.IntValue == -1) {
655+
DebugPrint("[OSdb] Replay mode is -1, skipping replay upload");
653656
delete pack;
654657
return;
655658
}
656659

657660
char replayPath[PLATFORM_MAX_PATH];
658661
pack.ReadString(replayPath, sizeof(replayPath));
659662
delete pack;
663+
664+
DebugPrint("[OSdb] Replay mode = %d, replayPath = '%s'", gCV_ReplayMode.IntValue, replayPath);
660665

661666
if (error[0] != '\0')
662667
{
663668
LogError("[OSdb] Record submission failed: %s", error);
664669
return;
665670
}
666671

672+
DebugPrint("[OSdb] HTTP response status: %d", resp.Status);
673+
667674
if (resp.Status != HTTPStatus_OK && resp.Status != HTTPStatus_Created)
668675
{
669676
LogError("[OSdb] Record submission failed with status %d", resp.Status);
@@ -672,17 +679,26 @@ public void OnRecordSubmitted(HTTPResponse resp, any value, const char[] error)
672679

673680
if (resp.Data == null)
674681
{
675-
DebugPrint("[OSdb] Record submitted but no replay key in response");
682+
DebugPrint("[OSdb] Record submitted but resp.Data is null, no replay key in response");
676683
return;
677684
}
678685

679686
JSONObject data = view_as<JSONObject>(resp.Data);
680687
char replayKey[128];
681-
if (data.GetString("replay_key", replayKey, sizeof(replayKey)) && replayKey[0] != '\0' && replayPath[0] != '\0')
688+
bool hasReplayKey = data.GetString("replay_key", replayKey, sizeof(replayKey));
689+
690+
DebugPrint("[OSdb] Has replay_key in response: %s, value: '%s', replayPath: '%s'",
691+
hasReplayKey ? "true" : "false", replayKey, replayPath);
692+
693+
if (hasReplayKey && replayKey[0] != '\0' && replayPath[0] != '\0')
682694
{
683-
DebugPrint("[OSdb] Got replay key from response: %s", replayKey);
695+
DebugPrint("[OSdb] Got replay key from response: %s, calling UploadReplay", replayKey);
684696
UploadReplay(replayKey, replayPath);
685697
}
698+
else {
699+
DebugPrint("[OSdb] Skipping replay upload - replayKey empty: %d, replayPath empty: %d",
700+
replayKey[0] == '\0', replayPath[0] == '\0');
701+
}
686702
}
687703

688704
public void OnReplayUploaded(HTTPStatus status, any value)

0 commit comments

Comments
 (0)