Browse Source

Nick's fix.

cl-refactor
Gav Wood 11 years ago
parent
commit
5ba305f347
  1. 14
      eth/eth.js
  2. 4
      eth/main.cpp

14
eth/eth.js

@ -23,6 +23,7 @@ var eth = (function ethScope() {
m_reqId++
var request = new XMLHttpRequest();
request.open("POST", "http://localhost:8080", false);
console.log("Sending " + JSON.stringify(req))
request.send(JSON.stringify(req));
return JSON.parse(request.responseText).result;
}
@ -59,18 +60,21 @@ var eth = (function ethScope() {
ret[m] = function() { return reqSync(m, getParams(arguments)) }
})(spec[si]);
ret.check = function() {
if (!m_watching)
ret.check = function(force) {
if (!force && isEmpty(m_watching))
return
var watching = [];
for (var w in m_watching)
watching.push(w)
console.log("Checking " + JSON.stringify(watching));
var changed = reqSync("check", watching);
var changed = reqSync("check", { "a": watching } );
console.log("Got " + JSON.stringify(changed));
for (var c in changed)
m_watching[c]()
setTimeout(this.check, 5000)
console.log("Setting timeout");
var that = this;
setTimeout(function() { that.check() }, 5000)
console.log("OK");
}
ret.watch = function(a, fx, f) {
@ -84,7 +88,9 @@ var eth = (function ethScope() {
this.check()
}
ret.unwatch = function(f, fx) {
console.log(JSON.stringify(m_watching) + " " + (m_watching == {}))
delete m_watching[fx ? f + fx : f];
console.log(JSON.stringify(m_watching) + " " + (m_watching == {}))
}
ret.newBlock = function(f) {
console.log(JSON.stringify(m_watching) + " " + (m_watching == {}))

4
eth/main.cpp

@ -351,6 +351,7 @@ int main(int argc, char** argv)
iss >> g_logVerbosity;
cout << "Verbosity: " << g_logVerbosity << endl;
}
#if ETH_JSONRPC
else if (cmd == "jsonport")
{
if (iss.peek() != -1)
@ -371,6 +372,7 @@ int main(int argc, char** argv)
jsonrpcServer->StopListening();
jsonrpcServer.reset();
}
#endif
else if (cmd == "address")
{
cout << "Current address:" << endl;
@ -443,8 +445,10 @@ int main(int argc, char** argv)
else
cout << "Unrecognised command. Type 'help' for help in interactive mode." << endl;
}
#if ETH_JSONRPC
if (jsonrpcServer.get())
jsonrpcServer->StopListening();
#endif
}
else
{

Loading…
Cancel
Save