MCPcopy Create free account
hub / github.com/Tencent/UnLua / check_dirty

Function check_dirty

Plugins/UnLuaExtensions/LuaSocket/Source/src/select.cpp:158–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158static int check_dirty(lua_State *L, int tab, int dtab, fd_set *set) {
159 int ndirty = 0, i = 1;
160 if (lua_isnil(L, tab))
161 return 0;
162 for ( ;; ) {
163 t_socket fd;
164 lua_pushnumber(L, i);
165 lua_gettable(L, tab);
166 if (lua_isnil(L, -1)) {
167 lua_pop(L, 1);
168 break;
169 }
170 fd = getfd(L);
171 if (fd != SOCKET_INVALID && dirty(L)) {
172 lua_pushnumber(L, ++ndirty);
173 lua_pushvalue(L, -2);
174 lua_settable(L, dtab);
175 FD_CLR(fd, set);
176 }
177 lua_pop(L, 1);
178 i = i + 1;
179 }
180 return ndirty;
181}
182
183static void return_fd(lua_State *L, fd_set *set, t_socket max_fd,
184 int itab, int tab, int start) {

Callers 1

global_selectFunction · 0.85

Calls 6

lua_pushnumberFunction · 0.85
lua_gettableFunction · 0.85
getfdFunction · 0.85
dirtyFunction · 0.85
lua_pushvalueFunction · 0.85
lua_settableFunction · 0.85

Tested by

no test coverage detected