AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Callbacks not executed (https://forums.alliedmods.net/showthread.php?t=317589)

Me1 07-20-2019 15:21

Callbacks not executed
 
Hi Guys
I am writing plugin which requires access to external resources, i chose REST requests and ripextextension this is part of my plugin with debug inserts

Code:

public void OnPluginStart()
{
    PrintToServer("Started");

    PrintToServer("1");
    HTTPClient hHTTPClient = new HTTPClient("https://httpbin.org");
    JSONObject hJSONObject = CreateJSONObject();
    PrintToServer("2");

    hHTTPClient.Get("get", OnHTTPResponse, 0);
    PrintToServer("3");

    hHTTPClient.Post("post", hJSONObject, OnHTTPResponse, 1);
    PrintToServer("4");

    hHTTPClient.Put("put", hJSONObject, OnHTTPResponse, 2);
    hHTTPClient.Patch("patch", hJSONObject, OnHTTPResponse, 3);
    hHTTPClient.Delete("delete", OnHTTPResponse, 4);
    hHTTPClient.Get("gzip", OnHTTPResponse, 5);

    delete hJSONObject;
    PrintToServer("Finished");

}

public void OnHTTPResponse(HTTPResponse response, any value)
{
    if (response.Status != HTTPStatus_OK) {
        PrintToServer("[ERR] %s Status: %d", sHTTPTags[value], response.Status);
        return;
    }
    if (response.Data == null) {
        PrintToServer("[OK] %s No response", sHTTPTags[value]);
        return;
    }

    char sData[1024];
    response.Data.ToString(sData, sizeof(sData), JSON_INDENT(4));

    PrintToServer("[OK] %s Response:\n%s", sHTTPTags[value], sData);
}

JSONObject CreateJSONObject()
{
    JSONObject hJSONObject = new JSONObject();
    hJSONObject.SetInt("id", 1);
    hJSONObject.SetFloat("jsonrpc", 2.0);
    hJSONObject.SetString("method", "subtract");

    JSONArray hJSONArray = new JSONArray();
    hJSONArray.PushInt(42);
    hJSONArray.PushInt(23);
    hJSONObject.Set("params", hJSONArray);

    delete hJSONArray;
    return hJSONObject;
}

And it's console output:
Code:

NET_CloseAllSockets
---- Host_NewGame ----
Host_NewGame on map zm_toxic_house3_hdr
CGameEventManager::AddListener: event 'teamplay_win_panel' unknown.
CGameEventManager::AddListener: event 'teamplay_restart_round' unknown.
CGameEventManager::AddListener: event 'arena_win_panel' unknown.
Started
1
2
3
4
Finished
GameTypes: missing mapgroupsSP entry for game type/mode (custom/custom).

I don't get responses from callbacks - like they were never called and no error messages - basically like these callbacks were empty functions. Initially i thought it's fault of extension so i tested curl, socket based, etc.
So now is my question, what are possible known root causes of such behaviour?
EDIT:
I am using sourcemod 1.10 (required for zombie plague by Qubka) - but this type of behaviours occurs also on 1.9
And it's also development server with no steam account token, but with gslt token sitation looks exactly the same
I also repeated everything on clear server that means only ripext + my plugin - which is basically modified ripext test ( only with PrintToServer added)

Fyren 07-23-2019 13:25

Re: Callbacks not executed
 
This isn't really a scripting question. If REST in Pawn isn't reporting any errors in the SM logs, you're probably going to have to start debugging it if you know C++.

Me1 07-31-2019 12:17

Re: Callbacks not executed
 
That's kind of information i needed. I will start off by testing non-dev builds on linux ( as i tested them on windows so far ) and later, if i don't succed i will try to build and debug these libraries on my own. Thanks for your help :)

Peace-Maker 07-31-2019 12:57

Re: Callbacks not executed
 
Make sure your server isn't hibernating by joining or using sv_hibernate_when_empty 0. If the callbacks are processed OnGameFrame and there are no frames executed, you won't see any callbacks.

Me1 07-31-2019 14:32

Re: Callbacks not executed
 
Wow! :D Peace-Maker you're the Man. That was not that obvious for me. Thanks a lot! ;)


All times are GMT -4. The time now is 20:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.