Software /
code /
prosody
Comparison
net/server_select.lua @ 5330:0a0ca2eb991b
net.server_select: Be less aggressive about server pause
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 12 Feb 2013 03:24:30 +0100 |
parent | 5289:ec50ad93e280 |
child | 5331:ffa740b4f08d |
comparison
equal
deleted
inserted
replaced
5329:9fffd5fad4b3 | 5330:0a0ca2eb991b |
---|---|
199 handler = nil | 199 handler = nil |
200 socket = nil | 200 socket = nil |
201 --mem_free( ) | 201 --mem_free( ) |
202 out_put "server.lua: closed server handler and removed sockets from list" | 202 out_put "server.lua: closed server handler and removed sockets from list" |
203 end | 203 end |
204 handler.pause = function() | 204 handler.pause = function( hard ) |
205 if not handler.paused then | 205 if not handler.paused then |
206 socket:close( ) | |
207 _sendlistlen = removesocket( _sendlist, socket, _sendlistlen ) | |
208 _readlistlen = removesocket( _readlist, socket, _readlistlen ) | 206 _readlistlen = removesocket( _readlist, socket, _readlistlen ) |
209 _socketlist[ socket ] = nil | 207 if hard then |
210 socket = nil; | 208 _socketlist[ socket ] = nil |
209 socket:close( ) | |
210 socket = nil; | |
211 end | |
211 handler.paused = true; | 212 handler.paused = true; |
212 end | 213 end |
213 end | 214 end |
214 handler.resume = function() | 215 handler.resume = function( ) |
215 if handler.paused then | 216 if handler.paused then |
216 socket = socket_bind( ip, serverport ); | 217 if not socket then |
217 socket:settimeout( 0 ) | 218 socket = socket_bind( ip, serverport ); |
219 socket:settimeout( 0 ) | |
220 end | |
218 _readlistlen = addsocket(_readlist, socket, _readlistlen) | 221 _readlistlen = addsocket(_readlist, socket, _readlistlen) |
219 _socketlist[ socket ] = handler | 222 _socketlist[ socket ] = handler |
220 handler.paused = false; | 223 handler.paused = false; |
221 end | 224 end |
222 end | 225 end |