plugin induced server hang
#1
The lua script I wrote for McBans works, the problem is if mcbans happens to be down then the server will hang until the lua script is done trying to fetch the url.

Any ideas on how to resolve this?
Reply
Thanks given by:
#2
your using wget right set -T seconds
like -T 1 its the timeout so it will timeout after 1 sec of trying.

Edit:
http://www.gnu.org/software/wget/manual/...tions.html

if the full timeout gives trouble with reading you might just wanna use
--connect-timeout=seconds for just the connection timeout Smile.
Reply
Thanks given by:
#3
thanks, but I don't like the idea of a busy server hanging up to one second at a time every time someone logs in or DCs. It's better than a 20 second hang though. lol
Reply
Thanks given by:
#4
Use cTCPLink. Can't explain how it works right nowTongue Try to figure it out
Reply
Thanks given by:
#5
haha, thanks, I'll look into it.
Reply
Thanks given by:
#6
I can get this to return true,

Lua__cTCPLink():Connect( "omencraft.com", 80 )

, but that's all I've been able to figure out so far. Any more hints you can give? It seems like once a port is open I need some kind of hook for the plugin to pickup on to send data, and another one to receive data, there aren't any hooks like that in cPluginManager.cpp though.


This always returns a nil value:
Lua__cTCPLink():ReceivedData( data, size )

abd using that as a function in the lua causes a c stack overflow:

function Lua__cTCPLink():ReceivedData( data, size )
print("hello world")
end
Reply
Thanks given by:
#7
Like the plugin, create a new instance of it in Lua

Code:
MyTCPLink = {}
MyTCPLink.__index = MyTCPLink

function MyTCPLink:new()
   local t = {}
   setmetatable(t, CorePlugin)
   local w = Lua__cTCPLink:new()
   tolua.setpeer(w, t)
   w:tolua__set_instance(w)
   return w
end

Then implement the ReceivedData function
Code:
function MyTCPLink:ReceivedData( data, size )
    print("hello world")
end

And create the instance

Code:
Link = MyTCPLink:new()

It's not perfect, so I think it needs workTongue but it should work for really basic things
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)