Skip to content

Commit

Permalink
[shell] Clean up shutdown handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
turon committed Jan 7, 2022
1 parent 2f82dec commit b496878
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/standalone/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
//
// To build with this flag, pass 'treat_warnings_as_errors=false' to gn/ninja.
//
#define CHIP_CONFIG_SECURITY_TEST_MODE 0
#define CHIP_CONFIG_SECURITY_TEST_MODE 1
#define CHIP_CONFIG_REQUIRE_AUTH 1

// Increase session idle timeout in stand-alone builds for the convenience of developers.
Expand Down
5 changes: 5 additions & 0 deletions examples/shell/shell_common/cmd_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ bool lowPowerClusterSleep()
static chip::Shell::Engine sShellServerSubcommands;
static uint16_t sServerPortOperational = CHIP_PORT;
static uint16_t sServerPortCommissioning = CHIP_UDC_PORT;
static bool sServerEnabled = false;

static CHIP_ERROR CmdAppServerHelp(int argc, char ** argv)
{
Expand All @@ -57,12 +58,16 @@ static CHIP_ERROR CmdAppServerStart(int argc, char ** argv)
// Initialize device attestation config
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());

sServerEnabled = true;

return CHIP_NO_ERROR;
}

static CHIP_ERROR CmdAppServerStop(int argc, char ** argv)
{
if (sServerEnabled == false) return CHIP_NO_ERROR;
chip::Server::GetInstance().Shutdown();
sServerEnabled = false;
return CHIP_NO_ERROR;
}

Expand Down

0 comments on commit b496878

Please sign in to comment.