hold error
This commit is contained in:
parent
8fb073b203
commit
2dc0bee187
17
net/init.lua
17
net/init.lua
@ -452,10 +452,12 @@ function net:newUDPClient(host,port,servercode,nonluaServer)
|
|||||||
c.OnClientDisconnected=multi:newConnection()
|
c.OnClientDisconnected=multi:newConnection()
|
||||||
c.OnConnectionRegained=multi:newConnection()
|
c.OnConnectionRegained=multi:newConnection()
|
||||||
c.notConnected=multi:newFunction(function(self)
|
c.notConnected=multi:newFunction(function(self)
|
||||||
self:hold(3)
|
multi:newAlarm(3):OnRing(function(alarm)
|
||||||
if self.link:IDAssigned()==false then
|
if self.link:IDAssigned()==false then
|
||||||
self.link.OnServerNotAvailable:Fire("Can't connect to the server: no response from server")
|
self.link.OnServerNotAvailable:Fire("Can't connect to the server: no response from server")
|
||||||
end
|
end
|
||||||
|
alarm:Destroy()
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
c.notConnected.link=c
|
c.notConnected.link=c
|
||||||
if not nonluaServer then
|
if not nonluaServer then
|
||||||
@ -695,9 +697,10 @@ function net:newTCPClient(host,port)
|
|||||||
self.tcp=socket.connect(self.ip,self.port)
|
self.tcp=socket.connect(self.ip,self.port)
|
||||||
if self.tcp==nil then
|
if self.tcp==nil then
|
||||||
print("Can't connect to the server: No response from server!")
|
print("Can't connect to the server: No response from server!")
|
||||||
func:hold(3)
|
multi:newAlarm(3):OnRing(function(alarm)
|
||||||
self:reconnect()
|
self:reconnect()
|
||||||
return
|
return
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
self.OnConnectionRegained:Fire(self)
|
self.OnConnectionRegained:Fire(self)
|
||||||
self.tcp:settimeout(0)
|
self.tcp:settimeout(0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user