Software /
code /
prosody
Comparison
net/server_epoll.lua @ 9384:5c8006ce8cb8
net.server_epoll: Include errno in log messages
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 26 Sep 2018 14:57:09 +0200 |
parent | 9383:3260902a5b22 |
child | 9385:58fe099043ed |
comparison
equal
deleted
inserted
replaced
9383:3260902a5b22 | 9384:5c8006ce8cb8 |
---|---|
262 if fd < 0 then | 262 if fd < 0 then |
263 return nil, "invalid fd"; | 263 return nil, "invalid fd"; |
264 end | 264 end |
265 if r == nil then r = self._wantread; end | 265 if r == nil then r = self._wantread; end |
266 if w == nil then w = self._wantwrite; end | 266 if w == nil then w = self._wantwrite; end |
267 local ok, err = poll:add(fd, r, w); | 267 local ok, err, errno = poll:add(fd, r, w); |
268 if not ok then | 268 if not ok then |
269 log("error", "Could not register %s: %s", self, err); | 269 log("error", "Could not register %s: %s(%d)", self, err); |
270 return ok, err; | 270 return ok, err; |
271 end | 271 end |
272 self._wantread, self._wantwrite = r, w; | 272 self._wantread, self._wantwrite = r, w; |
273 fds[fd] = self; | 273 fds[fd] = self; |
274 log("debug", "Watching %s", self); | 274 log("debug", "Watching %s", self); |
280 if fd < 0 then | 280 if fd < 0 then |
281 return nil, "invalid fd"; | 281 return nil, "invalid fd"; |
282 end | 282 end |
283 if r == nil then r = self._wantread; end | 283 if r == nil then r = self._wantread; end |
284 if w == nil then w = self._wantwrite; end | 284 if w == nil then w = self._wantwrite; end |
285 local ok, err = poll:set(fd, r, w); | 285 local ok, err, errno = poll:set(fd, r, w); |
286 if not ok then | 286 if not ok then |
287 log("error", "Could not update poller state %s: %s", self, err); | 287 log("error", "Could not update poller state %s: %s(%d)", self, err, errno); |
288 return ok, err; | 288 return ok, err; |
289 end | 289 end |
290 self._wantread, self._wantwrite = r, w; | 290 self._wantread, self._wantwrite = r, w; |
291 return true; | 291 return true; |
292 end | 292 end |
297 return nil, "invalid fd"; | 297 return nil, "invalid fd"; |
298 end | 298 end |
299 if fds[fd] ~= self then | 299 if fds[fd] ~= self then |
300 return nil, "unregistered fd"; | 300 return nil, "unregistered fd"; |
301 end | 301 end |
302 local ok, err = poll:del(fd); | 302 local ok, err, errno = poll:del(fd); |
303 if not ok then | 303 if not ok then |
304 log("error", "Could not unregister %s: %s", self, err); | 304 log("error", "Could not unregister %s: %s(%d)", self, err, errno); |
305 return ok, err; | 305 return ok, err; |
306 end | 306 end |
307 self._wantread, self._wantwrite = nil, nil; | 307 self._wantread, self._wantwrite = nil, nil; |
308 fds[fd] = nil; | 308 fds[fd] = nil; |
309 log("debug", "Unwatched %s", self); | 309 log("debug", "Unwatched %s", self); |