Browse Source

reject addcoin req if daemon port is taken (native)

all-modes
pbca26 8 years ago
parent
commit
6cbc984385
  1. 47
      react/src/actions/actions/addCoin.js
  2. 4
      react/src/components/addcoin/payload.js

47
react/src/actions/actions/addCoin.js

@ -159,6 +159,17 @@ export function iguanaAddCoin(coin, mode, acData, port) {
}
}
function handleErrors(response) {
let _parsedResponse;
if (!response.ok) {
return null;
} else {
_parsedResponse = response.text().then(function(text) { return text; });
return _parsedResponse;
}
}
export function shepherdHerd(coin, mode, path, startupParams) {
let acData;
let herdData = {
@ -251,23 +262,35 @@ export function shepherdHerd(coin, mode, path, startupParams) {
)
);
})
.then(response => response.json())
.then(handleErrors)
.then(function(json) {
if (Config.iguanaLessMode) {
dispatch(
addCoinResult(coin, mode)
);
setTimeout(() => {
if (json) {
if (Config.iguanaLessMode) {
dispatch(
iguanaActiveHandleBypass()
addCoinResult(coin, mode)
);
}, 1000);
setTimeout(() => {
dispatch(
iguanaActiveHandleBypass()
);
}, 1000);
} else {
dispatch(
iguanaAddCoin(
coin,
mode,
acData
)
);
}
} else {
console.warn(acData);
dispatch(
iguanaAddCoin(
coin,
mode,
acData
triggerToaster(
`Error starting ${coin} daemon. Port ${acData.rpc} is already taken!`,
translate('TOASTR.SERVICE_NOTIFICATION'),
'error',
false
)
);
}

4
react/src/components/addcoin/payload.js

@ -704,8 +704,8 @@ export function startAssetChain(confpath, coin, mode, getSuppyOnly) {
'WLC': {
'name': 'WIRELESS',
'supply': 210000000,
'AddCoinData': confpath ? Object.assign({}, _acPayloadOrigin, {'coin':'WLC','conf':'WLC.conf','path':confpath,'RELAY':-1,'VALIDATE':0,'startpend':4,'endpend':4,'maxpeers':8,'newcoin':'WLC','name':'WIRELESS','netmagic':'62071ed3','p2p':assetChainPorts.WIRELESS - 1,'rpc':assetChainPorts.WIRELESS}) : {},
'AddCoinDataVar': Object.assign({}, _acPayloadOrigin, {'userpass':tmpIguanaRPCAuth,'RELAY':mode,'VALIDATE':mode,'startpend':tmpPendValue,'endpend':tmpPendValue,'maxpeers':8,'newcoin':'WLC','name':'WIRELESS','netmagic':'62071ed3','p2p':assetChainPorts.WIRELESS - 1,'rpc':assetChainPorts.WIRELESS})
'AddCoinData': confpath ? Object.assign({}, _acPayloadOrigin, {'coin':'WLC','conf':'WLC.conf','path':confpath,'RELAY':-1,'VALIDATE':0,'startpend':4,'endpend':4,'maxpeers':8,'newcoin':'WLC','name':'WIRELESS','netmagic':'62071ed3','p2p':assetChainPorts.WLC - 1,'rpc':assetChainPorts.WLC}) : {},
'AddCoinDataVar': Object.assign({}, _acPayloadOrigin, {'userpass':tmpIguanaRPCAuth,'RELAY':mode,'VALIDATE':mode,'startpend':tmpPendValue,'endpend':tmpPendValue,'maxpeers':8,'newcoin':'WLC','name':'WIRELESS','netmagic':'62071ed3','p2p':assetChainPorts.WLC - 1,'rpc':assetChainPorts.WLC})
},
'PANGEA': {
'name': 'PANGEA',

Loading…
Cancel
Save