added instance version and eth version

This commit is contained in:
cubedro 2015-02-16 23:53:32 +02:00
parent 024af1ebfb
commit 367b0ed1d2
2 changed files with 12 additions and 7 deletions

View File

@ -56,6 +56,11 @@ cd ~
ln -s ~/opt/cpp-ethereum-build/alethzero/alethzero ~/bin/alethzero ln -s ~/opt/cpp-ethereum-build/alethzero/alethzero ~/bin/alethzero
ln -s ~/opt/cpp-ethereum-build/eth/eth ~/bin/eth ln -s ~/opt/cpp-ethereum-build/eth/eth ~/bin/eth
# install cloud-utils to fetch instance meta-data
sudo apt-get -y install cloud-utils
EC2_INSTANCE_ID=$(ec2metadata --instance-id)
ETH_VERSION=$(eth -V)
# add node service # add node service
cd ~/bin cd ~/bin
[ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www [ ! -d "www" ] && git clone https://github.com/cubedro/eth-net-intelligence-api www

View File

@ -23,8 +23,8 @@ function Node()
var self = this; var self = this;
this.info = { this.info = {
name: process.env.ETH_CLIENT || 'C++', name: process.env.EC2_INSTANCE_ID || 'Local Node',
type: process.env.ETH_TYPE || '0.8.1', node: process.env.ETH_VERSION || 'eth version 0.8.1',
os: os.platform(), os: os.platform(),
os_v: os.release() os_v: os.release()
}; };
@ -49,7 +49,7 @@ function Node()
errors: [] errors: []
} }
this.socket = null; this._socket = null;
this.pendingWatch = false; this.pendingWatch = false;
this.chainWatch = false; this.chainWatch = false;
this.updateInterval = false; this.updateInterval = false;
@ -59,11 +59,11 @@ function Node()
// this.init(); // this.init();
socket.on('open', function open() { socket.on('open', function open() {
self.socket = true; self._socket = true;
self.emit('hello', self.info); self.emit('hello', self.info);
console.log('The connection has been opened.'); console.log('The connection has been opened.');
}).on('end', function end() { }).on('end', function end() {
self.socket = false; self._socket = false;
}).on('error', function error(err) { }).on('error', function error(err) {
console.log(err); console.log(err);
}).on('reconnecting', function reconnecting(opts) { }).on('reconnecting', function reconnecting(opts) {
@ -278,7 +278,7 @@ Node.prototype.setWatches = function()
Node.prototype.emit = function(message, payload) Node.prototype.emit = function(message, payload)
{ {
if(this.socket){ if(this._socket){
try { try {
socket.emit(message, payload); socket.emit(message, payload);
} }
@ -296,7 +296,7 @@ Node.prototype.init = function()
Node.prototype.stop = function() Node.prototype.stop = function()
{ {
if(this.socket) if(this._socket)
socket.end(socket.id); socket.end(socket.id);
if(this.updateInterval) if(this.updateInterval)