Software /
code /
prosody
Comparison
util-src/poll.c @ 9475:9b26a50cdfe3
util.poll: Early return from __gc in case of no valid epoll FD
This could happen if the epoll FD has already been closed or
the epoll_create call failed
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 11 Oct 2018 18:50:04 +0200 |
parent | 9450:b890ceb1c24f |
child | 9476:f3935aa4cc7e |
comparison
equal
deleted
inserted
replaced
9474:619ba78709a5 | 9475:9b26a50cdfe3 |
---|---|
349 * Close epoll FD | 349 * Close epoll FD |
350 */ | 350 */ |
351 int Lgc(lua_State *L) { | 351 int Lgc(lua_State *L) { |
352 struct Lpoll_state *state = luaL_checkudata(L, 1, STATE_MT); | 352 struct Lpoll_state *state = luaL_checkudata(L, 1, STATE_MT); |
353 | 353 |
354 if(state->epoll_fd != -1) { | |
355 return 0; | |
356 } | |
357 | |
354 if(close(state->epoll_fd) == 0) { | 358 if(close(state->epoll_fd) == 0) { |
355 state->epoll_fd = -1; | 359 state->epoll_fd = -1; |
356 } | 360 } |
357 else { | 361 else { |
358 lua_pushstring(L, strerror(errno)); | 362 lua_pushstring(L, strerror(errno)); |