Raised This Month: $32 Target: $400
 8% 

Old thread


Post New Thread Closed Thread   
 
Thread Tools Display Modes
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 10-21-2011 , 07:01   Re: SteamTools - SteamWorks for SourceMod
#191

Quote:
Originally Posted by DaftMink View Post
Installed the extension, inc and test plugin but sm_setgamedescription only prints back the usage.
I made a typo in the plugin, either redownload and recompile the sp, or just add another argument after the description (it can be anything).

Quote:
Originally Posted by DaftMink View Post
Edit: also using the "map mapname" command crashed the server.
I'll look into it.

Quote:
Originally Posted by Sillium View Post
Linux dmp attached.
Thanks!

EDIT: Ok, I fixed it, it'll be in the next update.
__________________

Last edited by asherkin; 10-21-2011 at 07:40.
asherkin is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 10-21-2011 , 07:48   Re: SteamTools - SteamWorks for SourceMod
#192

Thanks for the reply.

Quote:
Originally Posted by asherkin View Post
I'm afraid ISteamHTTP only gives me a uint64 to do this with, and I'm already using all 64-bits to store required information in (the plugin and callback function).

The "handle" is provided by the ISteamHTTP API, it's not a SourceMod handle.
If I understand correctly, using SM's IHandleSys could solve both of these problems. You would have to wrap ISteamHTTP features into SM handles.

As an example, the cURL extension does this:
PHP Code:
native Handle:curl_easy_init(); 
Code:
static cell_t sm_curl_easy_init(IPluginContext *pContext, const cell_t *params)
{
	CURL *curl = curl_easy_init();
	if(curl == NULL)
	{
		return BAD_HANDLE;
	}

	cURLHandle *handle = new cURLHandle();
	memset(handle->errorBuffer,0,sizeof(handle->errorBuffer));
	memset(handle->callback_Function, 0, sizeof(handle->callback_Function));
	memset(handle->UserData,0,sizeof(handle->UserData));
	handle->curl = curl;

	Handle_t hndl = handlesys->CreateHandle(g_cURLHandle, handle, pContext->GetIdentity(), myself_Identity, NULL);
	if(!hndl)
	{
		curl_easy_cleanup(handle->curl);
		delete handle;
		return BAD_HANDLE;
	}

	handle->hndl = hndl;
	return hndl;
}
PHP Code:
native curl_easy_perform_thread(Handle:hndlCURL_OnComplete:perform_callbackany:value=0); 
Code:
static cell_t sm_curl_easy_perform_thread(IPluginContext *pContext, const cell_t *params)
{
	SETUP_CURL_HANDLE();

	IPluginFunction *pFunction = pContext->GetFunctionById(params[2]);
	if(!pFunction)
	{
		return pContext->ThrowNativeError("Invalid function %x", params[2]);
	}

	handle->UserData[UserData_Type_Complete] = params[3];	
	handle->callback_Function[cURL_CallBack_COMPLETE] = pFunction;
	cURLThread *thread = new cURLThread(handle, cURLThread_Type_PERFORM);
	g_cURLManager.CreatecURLThread(thread);

	return 1;
}
__________________
GoD-Tony is offline
DaftMink
Member
Join Date: Apr 2009
Old 10-21-2011 , 12:43   Re: SteamTools - SteamWorks for SourceMod
#193

Just want to say thanks.

Also here's the error message I get when I use the "map mapname" command to change maps.

http://i335.photobucket.com/albums/m...k/Untitled.png
DaftMink is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 10-21-2011 , 13:21   Re: SteamTools - SteamWorks for SourceMod
#194

After some further testing, I noticed that the HTTPRequestComplete callback isn't always sent. I can't pinpoint the problem as it seems to fail randomly. Sometimes it will download 5 files, then on the 6th the callback won't fire at all. Same results on Windows and Linux.

Here is the test case I used to reproduce it. While this looks like an infinite loop, it randomly stops by itself... sometimes.
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <steamtools>

new attempts 0;

public 
Steam_FullyLoaded()
{
    
StartDownload();
}

StartDownload()
{
    if (
attempts++ >= 1000)
    {
        
PrintToServer("Stopping after 1000 downloads.");
        return;
    }
    
    
PrintToServer("Download attempt %i..."attempts);
    
    new 
HTTPRequestHandle:hRequest Steam_CreateHTTPRequest(HTTPMethod_GET"http://godtony.mooo.com/updater/updater.txt");
    
Steam_SendHTTPRequest(hRequestOnSteamHTTPComplete);
}

public 
OnSteamHTTPComplete(HTTPRequestHandle:HTTPRequestbool:requestSuccessfulHTTPStatusCode:statusCode)
{
    
PrintToServer("Request successful: %s"requestSuccessful "Yes" "No");
    
    if (
requestSuccessful && statusCode == HTTPStatusCode_OK)
    {
        
Steam_WriteHTTPResponseBody(HTTPRequest"steamtools_test.txt");
    }

    
Steam_ReleaseHTTPRequest(HTTPRequest);
    
    
StartDownload();

Code:
Download attempt 710...
Request successful: Yes
Download attempt 711...
Request successful: Yes
Download attempt 712...

- Stopped here so I reloaded it - 

sm plugins reload steamtools_test
[SM] Plugin steamtools_test.smx reloaded successfully.

Download attempt 1...
Request successful: Yes
Download attempt 2...
Request successful: Yes
Download attempt 3...
Request successful: Yes
Download attempt 4...
Request successful: Yes
Download attempt 5...
Request successful: Yes
Download attempt 6...
Request successful: Yes
Download attempt 7...

- Stopped again -
__________________

Last edited by GoD-Tony; 10-21-2011 at 13:22.
GoD-Tony is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 10-22-2011 , 13:14   Re: SteamTools - SteamWorks for SourceMod
#195

0.8.1 released.

Changes:
  • Fixed crash on server reinitialisation (i.e. the "map" command).
  • Fixed missing SteamAPICall callbacks (e.g. HTTP download complete).
  • Added passable data param to HTTP methods.
__________________
asherkin is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 10-23-2011 , 06:54   Re: SteamTools - SteamWorks for SourceMod
#196

Thank You!
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de
Sillium is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 10-24-2011 , 04:35   Re: SteamTools - SteamWorks for SourceMod
#197

Quote:
Originally Posted by asherkin View Post
0.8.1 released.
Tested the new fixes/features and it's working great.
__________________
GoD-Tony is offline
jungjunghoo
Senior Member
Join Date: Sep 2009
Old 10-24-2011 , 06:31   Re: SteamTools - SteamWorks for SourceMod
#198

Quote:
Originally Posted by asherkin View Post
0.8.1 released.

Changes:
  • Fixed crash on server reinitialisation (i.e. the "map" command).
  • Fixed missing SteamAPICall callbacks (e.g. HTTP download complete).
  • Added passable data param to HTTP methods.
0.8.1 stable work in linux?

Last edited by jungjunghoo; 10-24-2011 at 06:33.
jungjunghoo is offline
sinblaster
Grim Reaper
Join Date: Feb 2010
Location: Australia
Old 10-24-2011 , 07:44   Re: SteamTools - SteamWorks for SourceMod
#199

Please excuse my lack of knowladge. I compiled the test plugin in the first post (and the inc) I copied the test plugin code, called it steamtools.sp and compiled it. I am using the plug for game desc

I my logs I am getting errors spammed as below. Is there something I have done wrong?
Quote:
L 10/24/2011 - 216:10: Info (map "gg_chaos_arena_v1") (file "errors_20111024.log") L 10/24/2011 - 216:10: [SM] Plugin encountered error 15: Array index is out of bounds L 10/24/2011 - 216:10: [SM] Displaying call stack trace for plugin "steamtools.smx":
L 10/24/2011 - 216:10: [SM] [0] Line 74, steamtools.sp::Steam_StatsUnloaded()
L 10/24/2011 - 217:28: [SM] Plugin encountered error 15: Array index is out of bounds L 10/24/2011 - 217:28: [SM] Displaying call stack trace for plugin "steamtools.smx":
L 10/24/2011 - 217:28: [SM] [0] Line 74, steamtools.sp::Steam_StatsUnloaded()
__________________
Happy Happy Joy Joy


Last edited by sinblaster; 10-24-2011 at 16:16.
sinblaster is offline
m4ster
Senior Member
Join Date: Mar 2007
Old 10-24-2011 , 09:11   Re: SteamTools - SteamWorks for SourceMod
#200

My server console is being spammed with this on every httprequest:

__________________
m4ster is offline
Closed Thread


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 10:43.


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