Fix signer token updates (#3302)

* Manual bump of package.json (recovery)

* Debug

* Simplify status connections
This commit is contained in:
Jaco Greeff 2016-11-09 18:26:10 +01:00 committed by Arkadiy Paronyan
parent 29aecc2cff
commit 877cfe9b53
3 changed files with 6 additions and 12 deletions

View File

@ -85,11 +85,6 @@ export default class Status {
setTimeout(this._pollStatus, timeout); setTimeout(this._pollStatus, timeout);
}; };
const wasConnected = this._store.getState().nodeStatus.isConnected;
if (isConnected !== wasConnected) {
this._fetchEnode();
}
this._store.dispatch(statusCollection({ isConnected, isConnecting, needsToken, secureToken })); this._store.dispatch(statusCollection({ isConnected, isConnecting, needsToken, secureToken }));
if (!isConnected) { if (!isConnected) {
@ -111,8 +106,7 @@ export default class Status {
this._api.parity.netPort(), this._api.parity.netPort(),
this._api.parity.nodeName(), this._api.parity.nodeName(),
this._api.parity.rpcSettings(), this._api.parity.rpcSettings(),
this._api.eth.syncing(), this._api.eth.syncing()
this._pollTraceMode()
]) ])
.then(([clientVersion, coinbase, defaultExtraData, extraData, gasFloorTarget, hashrate, minGasPrice, netChain, netPeers, netPort, nodeName, rpcSettings, syncing, traceMode]) => { .then(([clientVersion, coinbase, defaultExtraData, extraData, gasFloorTarget, hashrate, minGasPrice, netChain, netPeers, netPort, nodeName, rpcSettings, syncing, traceMode]) => {
const isTest = netChain === 'morden' || netChain === 'testnet'; const isTest = netChain === 'morden' || netChain === 'testnet';
@ -134,12 +128,12 @@ export default class Status {
isTest, isTest,
traceMode traceMode
})); }));
nextTimeout();
}) })
.catch((error) => { .catch((error) => {
console.error('_pollStatus', error); console.error('_pollStatus', error);
nextTimeout();
}); });
nextTimeout();
} }
_pollLogs = () => { _pollLogs = () => {

View File

@ -23,7 +23,7 @@ export default class SecureApi extends Api {
super(new Api.Transport.Ws(url, sysuiToken)); super(new Api.Transport.Ws(url, sysuiToken));
this._isConnecting = true; this._isConnecting = true;
this._connectState = 0; this._connectState = sysuiToken === 'initial' ? 1 : 0;
this._needsToken = false; this._needsToken = false;
this._dappsPort = 8080; this._dappsPort = 8080;
this._signerPort = 8180; this._signerPort = 8180;
@ -110,7 +110,7 @@ export default class SecureApi extends Api {
console.log('SecureApi:connectSuccess', this._transport.token); console.log('SecureApi:connectSuccess', this._transport.token);
} }
updateToken (token, connectState) { updateToken (token, connectState = 0) {
this._connectState = connectState; this._connectState = connectState;
this._transport.updateToken(token.replace(/[^a-zA-Z0-9]/g, '')); this._transport.updateToken(token.replace(/[^a-zA-Z0-9]/g, ''));
this._followConnection(); this._followConnection();

View File

@ -128,7 +128,7 @@ class Connection extends Component {
const { api } = this.context; const { api } = this.context;
const { token } = this.state; const { token } = this.state;
api.updateToken(token); api.updateToken(token, 0);
this.setState({ token: '', validToken: false }); this.setState({ token: '', validToken: false });
} }
} }