Ignore network errors during logout
In case of a network failure during a logout request, there's no point in restoring the connection, but it is better to just close it.
This commit is contained in:
parent
861aa6fd45
commit
5011966115
|
@ -151,8 +151,7 @@ ifcore_logout(lua_State *lua)
|
||||||
luaL_error(lua, "wrong number of arguments");
|
luaL_error(lua, "wrong number of arguments");
|
||||||
luaL_checktype(lua, 1, LUA_TLIGHTUSERDATA);
|
luaL_checktype(lua, 1, LUA_TLIGHTUSERDATA);
|
||||||
|
|
||||||
while ((r = request_logout((session *)(lua_topointer(lua, 1)))) ==
|
r = request_logout((session *)(lua_topointer(lua, 1)));
|
||||||
STATUS_NONE);
|
|
||||||
|
|
||||||
lua_pop(lua, 1);
|
lua_pop(lua, 1);
|
||||||
|
|
||||||
|
|
|
@ -267,13 +267,21 @@ request_logout(session *ssn)
|
||||||
{
|
{
|
||||||
int t, r;
|
int t, r;
|
||||||
|
|
||||||
t = send_request(ssn, "LOGOUT");
|
if ((t = send_request(ssn, "LOGOUT")) == -1)
|
||||||
r = response_generic(ssn, t);
|
goto fail;
|
||||||
|
if ((r = response_generic(ssn, t)) == -1)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
close_connection(ssn);
|
if (r == STATUS_OK) {
|
||||||
session_destroy(ssn);
|
close_connection(ssn);
|
||||||
|
session_destroy(ssn);
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
fail:
|
||||||
|
session_destroy(ssn);
|
||||||
|
|
||||||
|
return STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue