Software / code / prosody
Comparison
net/server_select.lua @ 4388:eded80beab58
net.server_select: Never call onincoming with nil data when a listener doesn't have an onconnect handler
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 27 Sep 2011 17:28:56 +0100 |
| parent | 4353:f600591c87fa |
| child | 4393:7958680c459a |
comparison
equal
deleted
inserted
replaced
| 4387:06161b0b83f2 | 4388:eded80beab58 |
|---|---|
| 171 | 171 |
| 172 maxconnections = maxconnections or _maxclientsperserver | 172 maxconnections = maxconnections or _maxclientsperserver |
| 173 | 173 |
| 174 local connections = 0 | 174 local connections = 0 |
| 175 | 175 |
| 176 local dispatch, disconnect = listeners.onconnect or listeners.onincoming, listeners.ondisconnect | 176 local dispatch, disconnect = listeners.onconnect, listeners.ondisconnect |
| 177 | 177 |
| 178 local accept = socket.accept | 178 local accept = socket.accept |
| 179 | 179 |
| 180 --// public methods of the object //-- | 180 --// public methods of the object //-- |
| 181 | 181 |
| 230 if err then -- error while wrapping ssl socket | 230 if err then -- error while wrapping ssl socket |
| 231 return false | 231 return false |
| 232 end | 232 end |
| 233 connections = connections + 1 | 233 connections = connections + 1 |
| 234 out_put( "server.lua: accepted new client connection from ", tostring(ip), ":", tostring(clientport), " to ", tostring(serverport)) | 234 out_put( "server.lua: accepted new client connection from ", tostring(ip), ":", tostring(clientport), " to ", tostring(serverport)) |
| 235 return dispatch( handler ) | 235 if dispatch then |
| 236 return dispatch( handler ); | |
| 237 end | |
| 238 return; | |
| 236 elseif err then -- maybe timeout or something else | 239 elseif err then -- maybe timeout or something else |
| 237 out_put( "server.lua: error with new client connection: ", tostring(err) ) | 240 out_put( "server.lua: error with new client connection: ", tostring(err) ) |
| 238 return false | 241 return false |
| 239 end | 242 end |
| 240 end | 243 end |