minor fixes

This commit is contained in:
romanman 2014-05-31 08:38:30 +03:00
parent 711e55203a
commit 4a98b7ccfa
6 changed files with 14 additions and 106 deletions

View File

@ -1,100 +0,0 @@
package org.ethereum.net.message;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.timeout.ReadTimeoutHandler;
import org.ethereum.gui.PeerListener;
import org.ethereum.manager.MainData;
import org.ethereum.net.client.EthereumFrameDecoder;
import org.ethereum.net.peerdiscovery.EthereumPeerTasterHandler;
import org.ethereum.net.client.PeerData;
/**
* www.ethereumJ.com
* User: Roman Mandeleil
* Created on: 10/04/14 12:28
*/
public class PeerTaster {
PeerListener peerListener;
Channel channel;
public PeerTaster() {
}
public PeerTaster(PeerListener peerListener) {
this.peerListener = peerListener;
}
public void connect(String host, int port){
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
Bootstrap b = new Bootstrap();
b.group(workerGroup);
b.channel(NioSocketChannel.class);
final EthereumPeerTasterHandler handler = new EthereumPeerTasterHandler();
b.handler(new ChannelInitializer<NioSocketChannel>() {
@Override
public void initChannel(NioSocketChannel ch) throws Exception {
ch.pipeline().addLast("readTimeoutHandler", new ReadTimeoutHandler(15));
ch.pipeline().addLast(new EthereumFrameDecoder());
ch.pipeline().addLast(handler);
}
});
// Start the client.
b.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 3000);
ChannelFuture f = b.connect(host, port).sync(); // (5)
// Wait until the connection is closed.
f.channel().closeFuture().sync();
} catch (InterruptedException ie){
System.out.println("-- ClientPeer: catch (InterruptedException ie) --");
ie.printStackTrace();
} finally {
try {
workerGroup.shutdownGracefully().sync();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println("I am dead");
}
public static void main(String args[]){
PeerTaster peerTaster = new PeerTaster();
try {peerTaster.connect("54.211.14.10", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("82.217.72.169", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("54.201.28.117", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("54.2.10.41", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("0.204.10.41", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("54.204.10.41", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("54.211.14.10", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("82.217.72.169", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("54.201.28.117", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("54.2.10.41", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("0.204.10.41", 30303);} catch (Exception e) {e.printStackTrace();}
try {peerTaster.connect("54.204.10.41", 30303);} catch (Exception e) {e.printStackTrace();}
System.out.println("End of the roaad");
for (PeerData peer : MainData.instance.getPeers()){
System.out.println(peer.getInetAddress().getHostAddress().toString());
};
}
}

View File

@ -201,4 +201,6 @@ public class EthereumPeerTasterHandler extends ChannelInboundHandlerAdapter {
ctx.writeAndFlush(buffer);
}
}

View File

@ -29,6 +29,8 @@ public class WorkerThread implements Runnable {
logger.info(Thread.currentThread().getName()+" Start. Command = "+ peerData.toString());
processCommand();
logger.info(Thread.currentThread().getName()+" End.");
try {Thread.sleep(10000); } catch (InterruptedException e) {logger.error("sleep interrupted");}
poolExecutor.execute(this);
}

View File

@ -436,7 +436,7 @@ public class SerpentToAssemblyCompiler extends SerpentBaseVisitor<String> {
String operand0 = visit(ctx.expression());
return String.format(" %s MSIZE SWAP MSIZE MSTORE 32 SWAP RETURN ", operand0);
return String.format(" %s MEMSIZE SWAP MEMSIZE MSTORE 32 SWAP RETURN ", operand0);
}
@Override

View File

@ -22,10 +22,14 @@ public enum OpCode {
EXP(0x08),
NEG(0x09),
LT(0x0a),
SLT(0x0b),
SGT(0x0c),
GT(0x0b),
EQ(0x0c),
NOT(0x0d),
/**
* Bitwise Logic Operations
*/
@ -44,7 +48,7 @@ public enum OpCode {
/**
* Environmental Information
*/
ADDRESS(0x30),
BALANCE(0x31),
ORIGIN(0x32),
@ -60,7 +64,7 @@ public enum OpCode {
/**
* Block Information
*/
PREVHASH(0x40),
COINBASE(0x41),
TIMESTAMP(0x42),
@ -83,7 +87,7 @@ public enum OpCode {
JUMP(0x58),
JUMPI(0x59),
PC(0x5a),
MSIZE(0x5b),
MEMSIZE(0x5b),
GAS(0x5c),
/**

View File

@ -8,6 +8,6 @@ log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern= %d{HH:mm:ss} [%c{1}] %m%n
# filter noisy classes
log4j.logger.org.ethereum.net.peerdiscovery = INFO
log4j.logger.org.ethereum.net.peerdiscovery = WARN
log4j.logger.java.nio = WARN
log4j.logger.io.netty = WARN