Skip to content

Commit

Permalink
Fix daemon shutdown & integrate latest daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypt0hunter committed Mar 17, 2020
1 parent 29c5fcc commit 221ea66
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 29 deletions.
8 changes: 4 additions & 4 deletions Scripts/Packager/build-linux-x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ echo $log_prefix FINISHED restoring dotnet and npm packages

# dotnet publish
echo $log_prefix running 'dotnet publish'
cd $build_directory/xds/src/daemon
sudo dotnet clean
sudo dotnet restore
cd $build_directory/xds/src/Xds
#sudo dotnet clean
#sudo dotnet restore
sudo dotnet publish -c $configuration -r $os_platform-$arch -v m -o $build_directory/StratisCore.UI/daemon

echo $log_prefix chmoding the xds file
sudo chmod +x $build_directory/StratisCore.UI/daemon/Daemon*
sudo chmod +x $build_directory/StratisCore.UI/daemon/blockcore*

# node Build
cd $build_directory/StratisCore.UI
Expand Down
6 changes: 3 additions & 3 deletions Scripts/Packager/build-win-x64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ echo $log_prefix FINISHED restoring dotnet and npm packages

# dotnet publish
echo $log_prefix running 'dotnet publish'
cd $build_directory/xds/src/daemon
dotnet clean
dotnet restore
cd $build_directory/xds/src/Xds
#dotnet clean
#dotnet restore
dotnet publish -c $configuration -r $os_platform-$arch -v m -o $build_directory/StratisCore.UI/daemon

# node Build
Expand Down
64 changes: 44 additions & 20 deletions StratisCore.UI/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ app.on('ready', () => {
if (sidechain && !nodaemon) {
startDaemon("Stratis.SidechainD");
} else if (!nodaemon) {
startDaemon("Daemon")
startDaemon("blockcore.xdsd")
}
}
createTray();
Expand Down Expand Up @@ -144,27 +144,51 @@ app.on('activate', () => {
}
});

// function shutdownDaemon(portNumber) {
// var http = require('http');
// var data = 'true';
// var body = JSON.stringify(data);

// var request = new http.ClientRequest({
// method: 'POST',
// hostname: 'localhost',
// port: portNumber,
// path: '/api/node/shutdown',
// headers: {
// "Content-Type": "application/json",
// "Content-Length": Buffer.byteLength(body)
// }
// })

// request.write('true');
// request.on('error', function (e) { });
// request.on('timeout', function (e) { request.abort(); });
// request.on('uncaughtException', function (e) { request.abort(); });

// request.end(body);
// };

function shutdownDaemon(portNumber) {
var http = require('http');
var body = JSON.stringify({});

var request = new http.ClientRequest({
method: 'POST',
hostname: 'localhost',
port: portNumber,
path: '/api/node/shutdown',
headers: {
"Content-Type": "application/json",
"Content-Length": Buffer.byteLength(body)
}
})

request.write('true');
request.on('error', function (e) { });
request.on('timeout', function (e) { request.abort(); });
request.on('uncaughtException', function (e) { request.abort(); });

request.end(body);
var options = {
hostname: 'localhost',
port: portNumber,
path: '/api/node/shutdown',
method: 'POST'
};
var req = http.request(options);
req.on('response', function (res) {
if (res.statusCode === 200) {
console.log('Request to shutdown node daemon returned HTTP success code.');
}
else {
console.log('Request to shutdown node daemon returned HTTP failure code: ' + res.statusCode);
}
});
req.on('error', function (err) { });
req.setHeader('content-type', 'application/json-patch+json');
req.write('true');
req.end();
};

function startDaemon(daemonName) {
Expand Down
4 changes: 2 additions & 2 deletions StratisCore.UI/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "XDS-core",
"description": "XDS Core Wallet",
"version": "1.0.4",
"version": "1.0.6",
"author": {
"name": "XDS Platform",
"email": "[email protected]"
Expand Down Expand Up @@ -85,7 +85,7 @@
"core-js": "2.6.5",
"electron": "4.1.1",
"electron-builder": "20.39.0",
"electron-builder-squirrel-windows": "^22.3.3",
"electron-builder-squirrel-windows": "^22.4.1",
"electron-reload": "1.4.0",
"electron-winstaller": "^4.0.0",
"http-server": "^0.11.1",
Expand Down
1 change: 1 addition & 0 deletions X42-FullNode
Submodule X42-FullNode added at a9b338

0 comments on commit 221ea66

Please sign in to comment.