Raised This Month: $210 Target: $400
 52% 

[EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives


Post New Thread Reply   
 
Thread Tools Display Modes
lugui
Senior Member
Join Date: Feb 2016
Location: Brasil
Old 02-12-2018 , 17:18   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #81

httpRequest is a global variable, does it still need to be deleted?

Last edited by lugui; 02-12-2018 at 17:19.
lugui is online now
dordnung
Veteran Member
Join Date: Apr 2010
Location: Germany
Old 02-12-2018 , 17:20   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #82

With

PHP Code:
new System2HTTPRequest(OnHTTPSRequestEnd"https://lugui.in/fdlapi/Debug.php"); 
you always create a new handle, so for each new you need a delete.

You can also add the new to OnPluginStart and then only set the headers in Longpoll, then you don't need to delete it always
__________________
dordnung is offline
lugui
Senior Member
Join Date: Feb 2016
Location: Brasil
Old 02-12-2018 , 17:46   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #83

I made it:

PHP Code:
public void OnMapStart()
{
    
poll();
}

void poll()
{
    
System2HTTPRequest httpRequest = new System2HTTPRequest(OnHTTPSRequestEnd"https://lugui.in/fdlapi/Debug.php");
    
httpRequest.GET();    
    
delete httpRequest;
}

public 
void OnHTTPSRequestEnd(bool success, const char[] errorSystem2HTTPRequest requestSystem2HTTPResponse responseHTTPRequestMethod method)
{
    if(
success) {
            
char res[30];
            
response.GetContent(resresponse.ContentLength 1);
            
LogToFile("addons/sourcemod/logs/FDMLog.log""Received: %s"res);
    }
    
poll();

The simplest script possible, and it still crashing the server, Am I deleting it properly?

Last edited by lugui; 02-12-2018 at 17:46.
lugui is online now
dordnung
Veteran Member
Join Date: Apr 2010
Location: Germany
Old 02-12-2018 , 18:23   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #84

Mh, I'll take a look at it and write if i have new information.

Two remarks which have nothing to do with the crash:

1. Use OnPluginStart for the first poll, otherwise you will increase the request count on every map start
2. Use response.GetContent(res, sizeof(res)) instead of response.GetContent(res, response.ContentLength + 1)
__________________

Last edited by dordnung; 02-12-2018 at 18:23.
dordnung is offline
lugui
Senior Member
Join Date: Feb 2016
Location: Brasil
Old 02-12-2018 , 18:53   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #85

Got it. thx
lugui is online now
dordnung
Veteran Member
Join Date: Apr 2010
Location: Germany
Old 02-12-2018 , 21:34   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #86

Ok, I found the problem and fixed it.

I forgot to close finished threads, so from a certain amount of threads no new threads could be created.

Thanks for helping to reproduce this error!
__________________
dordnung is offline
lugui
Senior Member
Join Date: Feb 2016
Location: Brasil
Old 02-13-2018 , 11:23   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #87

Great!
It seams to be working properly. I will let the debug script running for some hours to see if it eventualy crashes.
Thankyou for the help.

Last edited by lugui; 02-13-2018 at 13:02.
lugui is online now
dordnung
Veteran Member
Join Date: Apr 2010
Location: Germany
Old 02-13-2018 , 12:00   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #88

Great to hear!

Yes please tell me if you find any bugs^^
__________________
dordnung is offline
nomy
Senior Member
Join Date: Dec 2009
Location: United Kingdom
Old 02-16-2018 , 21:43   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #89

[SM] Unable to load extension "system2.ext": Could not find interface: IPluginManager

Game: CS:S
nomy is offline
dordnung
Veteran Member
Join Date: Apr 2010
Location: Germany
Old 02-16-2018 , 21:48   Re: [EXTENSION] System2 - Easy to use HTTP/FTP Request API and useful system natives
Reply With Quote #90

Which sourcemod version do you use?

EDIT: I've recompiled the extension with sourcemod 1.7 for backwards compatibility
__________________

Last edited by dordnung; 02-17-2018 at 13:26.
dordnung 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 15:31.


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