From 8beb917c6c2d70e245116ead8789767b0c58e2f6 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Wed, 1 Feb 2012 13:24:15 -0500 Subject: [PATCH] Allow -upnp to override setting in wallet (and simplify logic a bit) --- src/init.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index d237e247e..4bb331290 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -487,16 +487,11 @@ bool AppInit2(int argc, char* argv[]) fAllowDNS = GetBoolArg("-dns"); fNoListen = GetBoolArg("-nolisten"); - if (fHaveUPnP) - { -#if USE_UPNP - if (GetBoolArg("-noupnp")) - fUseUPnP = false; -#else - if (GetBoolArg("-upnp")) - fUseUPnP = true; -#endif - } + // Command-line args override in-wallet settings: + if (mapArgs.count("-upnp")) + fUseUPnP = GetBoolArg("-upnp"); + else if (mapArgs.count("-noupnp")) + fUseUPnP = !GetBoolArg("-noupnp"); if (!fNoListen) {