From e2400f8fa97ea9a08ae614dbd27f2a902d2f702c Mon Sep 17 00:00:00 2001
From: g0dil <g0dil@wiback.org>
Date: Fri, 2 Jan 2009 16:20:50 +0000
Subject: [PATCH] Utils/Console: Small code cleanup in telnet implementation

---
 Utils/Console/Telnet.cc | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/Utils/Console/Telnet.cc b/Utils/Console/Telnet.cc
index c99efc32b..acf32cecb 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();
 }
 
-- 
GitLab