Raised This Month: $12 Target: $400
 3% 

Callbacks not executed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Me1
New Member
Join Date: Jan 2017
Old 07-20-2019 , 15:21   Callbacks not executed
Reply With Quote #1

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)

Last edited by Me1; 07-20-2019 at 17:36.
Me1 is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 07-23-2019 , 13:25   Re: Callbacks not executed
Reply With Quote #2

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++.
Fyren is offline
Me1
New Member
Join Date: Jan 2017
Old 07-31-2019 , 12:17   Re: Callbacks not executed
Reply With Quote #3

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
Me1 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 07-31-2019 , 12:57   Re: Callbacks not executed
Reply With Quote #4

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.
__________________
Peace-Maker is offline
Me1
New Member
Join Date: Jan 2017
Old 07-31-2019 , 14:32   Re: Callbacks not executed
Reply With Quote #5

Wow! Peace-Maker you're the Man. That was not that obvious for me. Thanks a lot! ;)
Me1 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:35.


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