Skip to content

Commit 6fe5918

Browse files
Configurable if reboot on panic (default true)
1 parent 3c23b5b commit 6fe5918

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

starbase/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,3 @@ set(LIBRARIES
5757

5858
# include service build script
5959
include($ENV{INCLUDEOS_PREFIX}/includeos/post.service.cmake)
60-
61-
diskbuilder(disk)

starbase/config.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"net" : [["10.0.0.42", "255.255.255.0", "10.0.0.1", "10.0.0.1"]],
2+
"net" : [["10.0.0.42", "255.255.255.0", "10.0.0.1", "10.0.0.1"]],
33
"uplink" : {
4-
"url" : "10.0.0.1:9090",
5-
"token" : "kappa123"
4+
"url" : "10.0.0.1:9090",
5+
"token" : "kappa123",
6+
"reboot" : true
67
}
78
}

ws_uplink.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ namespace uplink {
4949

5050
// This is not totally safe...
5151
LIVEUPD_LOCATION = (void*) (OS::heap_max() - 0x2000000); // 32MB below heap_max
52-
MYINFO("Maximum heap at (%p), assigning liveupdate location 32MB below (%p)", (void*)OS::heap_max(), LIVEUPD_LOCATION);
52+
MYINFO("Maximum heap at (%p), assigning liveupdate location 32MB below (%p)",
53+
(void*)OS::heap_max(), LIVEUPD_LOCATION);
5354

5455
read_config();
5556

57+
CHECK(config_.reboot, "Reboot on panic");
58+
5659
if(inet_.is_configured())
5760
{
5861
start(inet);
@@ -289,6 +292,12 @@ namespace uplink {
289292
config_.url = cfg["url"].GetString();
290293
config_.token = cfg["token"].GetString();
291294

295+
// Reboot on panic (optional)
296+
if(cfg.HasMember("reboot"))
297+
{
298+
config_.reboot = cfg["reboot"].GetBool();
299+
}
300+
292301
}
293302

294303
template <typename Writer, typename Stack_ptr>
@@ -457,7 +466,8 @@ namespace uplink {
457466
send_message(Transport_code::PANIC, why, strlen(why));
458467
ws_->close();
459468
inet_.nic().flush();
460-
OS::reboot();
469+
470+
if(config_.reboot) OS::reboot();
461471
}
462472

463473
void WS_uplink::send_stats()

ws_uplink.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class WS_uplink {
3838
{
3939
std::string url;
4040
std::string token;
41+
bool reboot = true;
4142
};
4243

4344
WS_uplink(net::Inet<net::IP4>&);

0 commit comments

Comments
 (0)