From: g0dil Date: Fri, 2 Jan 2009 16:20:50 +0000 (+0000) Subject: Utils/Console: Small code cleanup in telnet implementation X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=22cb180183d1e2f2e19b3cf4c9d99aa34f8315f3;p=senf.git Utils/Console: Small code cleanup in telnet implementation git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1035 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Utils/Console/Telnet.cc b/Utils/Console/Telnet.cc index c99efc3..acf32ce 100644 --- a/Utils/Console/Telnet.cc +++ b/Utils/Console/Telnet.cc @@ -399,18 +399,14 @@ prefix_ void senf::console::detail::BaseTelnetProtocol::response(OptInfo & info, } else if (enabled != info.enabled) { // Request to change the current state - bool accept (enabled); if (!enabled || enabled && (info.wantState == OptInfo::WANTED || info.wantState == OptInfo::ACCEPTED)) { - // Accept the request + // accept the request info.optionState = OptInfo::ACKNOWLEDGED; info.enabled = enabled; - } - else - // Reject the request - accept = info.enabled; + } // else reject the request transmit(CMD_IAC); - transmit((info.local ? CMD_WILL : CMD_DO) + (accept ? 0 : 1)); + transmit((info.local ? CMD_WILL : CMD_DO) + (info.enabled ? 0 : 1)); transmit(info.option); } else @@ -421,8 +417,8 @@ prefix_ void senf::console::detail::BaseTelnetProtocol::response(OptInfo & info, i->second->v_init(); } if (decrementCount) - // This call must be AFTER calling v_init since v_init might increment the request count - // again. Otherwise v_setupComplete might be called prematurely + // This call must be AFTER calling v_init since v_init might increment the request count. + // and v_setupComplete() might be called prematurely. decrementRequestCounter(); }