bartbes / love-misc-libs

Just some random libs I have lying around, now with version control!
http://docs.bartbes.com
110 stars 28 forks source link

[lube-testing] can't update server #9

Closed ghost closed 13 years ago

ghost commented 13 years ago

If I run, create a server, everything is running well.

When a client connects to the server and then I kill the server, I can't start the server again (for 20-40 seconds).

Kill the server with this code:

self.server.socket:close()
self.server = nil

And here is the errormsg (if I try to run, create the server after the kill):

Error: ./lib/LUBE/LUBE.lua:430: calling 'accept' on bad self (tcp{server} expected, got userdata)
stack traceback:
    [C]: in function 'accept'
    ./lib/LUBE/LUBE.lua:430: in function 'accept'
    ./lib/LUBE/LUBE.lua:205: in function 'update'
    ./class/Server.lua:84: in function 'update'
    [string "main.lua"]:72: in function 'update'
    [string "boot.lua"]:320: in function <[string "boot.lua"]:308>
    [C]: in function 'xpcall'

How can I kill a server correctly? Is this a bug or a fail by me?

bartbes commented 13 years ago

My email reply never made it here, I see, anyway, here's the message: You should use LUBE's closing, but otherwise it's an OS "feature", I should probably set reuseaddr.

ghost commented 13 years ago

It works with reuseaddr :) thanks ^^