Pausing before command - Page 2
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Pausing before command

Started by chaggydawg, 30 April, 2004, 14:14:23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NotRabidWombat

"you guys know how in some scripts the connection\disconnection methods can take a long time to process and they hold up the hub until they are"

We can't really make these assumptions without knowing more about the socket communication used by PtokaX, specifically assync vs sync.

Anyway, I'm not really sure you would see benifits to moving communication calls out of OnConnect, OnDisconnect. I *believe* these commands do not block and add the message to an out going queue. So no matter where you call them, any communication occuring after them will have to wait.

I also *believe* Disconnect does not do any kind of queuing and just kills the socket. This would explain the problem that started this thread.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

Corayzon

sorry u seem to have taken me wrong...

example::

you have

function connect(user)

end

now when u add some code like

function connect(user)

saveuserinfo(user)
inoutmsg(user)
checkbanned(user)

end

this will be executed like...

connect called...
process savesuerinfo and when function is done then
process inoutmsg and when function is done then
process checkbanned and when function is done then
then end function

what im thinkin is this...

is taking out an ordered process from it...

so...

function connect(user)

doLater(saveuserinfo(user))
inoutmsg(user)
doLater(checkbanned(user))

end

when the user connects ... he is allowed to connect strait away...not holding up the process,,, and then the other commands that were called in the connect function execute later...but also as a out of process component...meaning while the commands process...the rest f the server isnt help up by it

u get me?

NotRabidWombat

Well, I'm assuming that the functions inside of the OnConnect *need* to happen right then. Such as the checkbanneduser. If the user is banned, you really do not want them communicating with the hub.
Likewise, serializing table information should be taken care of in the next release with the OnExit command. Then saving periodically in case of a crash becomes the issue.

I forsee the DoLater concept being most effective when dealing with socket communications since only syncronous is allowed through lua right now.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

Corayzon

wells this is just an example and doesnt apply to anything...

i just wanted to show that i want to be able to process to commands at the same time...but not have one held up by the other...

i guess i cant explain...but in vb...its 'in process' and 'out process'...if u understand that...then ull understand what im asking

aswell as what im asking cant be proformed via a function cause the preprocessor needs a return to move out of a function and continue the process...if that makes any sense

NotRabidWombat

I understand what you are asking. You want a form of multithreading.

However, I can not imagine any function in the OnConnect or OnDisconnect that does not change the state of an object. If you're changing the state of an object with multiple threads you must ensure they do not change the object at the same time. This is called thread safety. So these statements will end up stopping each other anyway, defeating the purpose of having multiple threads.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

Corayzon

i see...but if this was implemented and done right, could this stop the amounts of lag sometimes made by functions reading through large files?

aswell as...what bout havein a database like this...cause most of these hold ups are from file reading and record replacing...

thankz

SMF spam blocked by CleanTalk