mirror of
https://github.com/nmap/nmap.git
synced 2026-08-28 20:41:12 +00:00
Correctly continue receive_buf on immediate error/success
This commit is contained in:
parent
9458beda4c
commit
3a528e1d1d
1 changed files with 3 additions and 3 deletions
|
|
@ -792,12 +792,12 @@ static int receive_buf (lua_State *L, int status, lua_KContext ctx)
|
|||
else
|
||||
{
|
||||
lua_pop(L, 2); /* pop 2 results */
|
||||
int oldtop = lua_gettop(L);
|
||||
nu->action = "RECEIVE BUF";
|
||||
nsock_read(nsp, nu->nsiod, receive_callback, nu->timeout, nu);
|
||||
if (nu->action == NU_ACTION_IMMEDIATE) {
|
||||
// Immediate return
|
||||
return lua_gettop(L) - oldtop;
|
||||
// Immediate return. We can't yield since the callback already ran, so we
|
||||
// call ourselves as a continuation just like Lua would have.
|
||||
return receive_buf(L, LUA_YIELD, 0);
|
||||
}
|
||||
return yield(L, nu, "RECEIVE BUF", FROM, 0, receive_buf);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue