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:
Lefteris Chatzimparmpas 2012-02-23 00:04:10 +01:00
parent 861aa6fd45
commit 5011966115
2 changed files with 13 additions and 6 deletions

View File

@ -151,8 +151,7 @@ ifcore_logout(lua_State *lua)
luaL_error(lua, "wrong number of arguments");
luaL_checktype(lua, 1, LUA_TLIGHTUSERDATA);
while ((r = request_logout((session *)(lua_topointer(lua, 1)))) ==
STATUS_NONE);
r = request_logout((session *)(lua_topointer(lua, 1)));
lua_pop(lua, 1);

View File

@ -267,13 +267,21 @@ request_logout(session *ssn)
{
int t, r;
t = send_request(ssn, "LOGOUT");
r = response_generic(ssn, t);
if ((t = send_request(ssn, "LOGOUT")) == -1)
goto fail;
if ((r = response_generic(ssn, t)) == -1)
goto fail;
close_connection(ssn);
session_destroy(ssn);
if (r == STATUS_OK) {
close_connection(ssn);
session_destroy(ssn);
}
return r;
fail:
session_destroy(ssn);
return STATUS_OK;
}