예제 #1
0
        public PoolClient(PoolInstance poolInstance, ICoinHandlerPool pool, ICoinHandlerMiner miner)
        {
            this.poolHandler  = pool;
            this.coinHandler  = miner;
            this.poolInstance = poolInstance;

            //Create a new instance of the MinerServer, which creates an instance of Network.Sockets.Server
            minerServer = new MinerServer(poolInstance.localListenPort, this, minerManager, coinHandler);

            //Create a new instance of the Network.Sockets.Client
            poolClient = new Client(poolInstance.GetCurrentPool().poolAddress, poolInstance.GetCurrentPool().poolPort);

            //define pool events
            poolClient.OnServerConnected    += PoolClient_OnServerConnected;
            poolClient.OnServerDataReceived += PoolClient_OnServerDataReceived;
            poolClient.OnServerDisconnected += PoolClient_OnServerDisconnected;
            poolClient.OnServerError        += PoolClient_OnServerError;

            //setup coin miner handler
            coinHandler.SetMinerServer(minerServer);
            coinHandler.SetPoolClient(this);
            coinHandler.SetMinerManager(minerManager);

            //setup coin Pool handler
            poolHandler.SetMinerServer(minerServer);
            poolHandler.SetPoolClient(this);
            poolHandler.SetMinerManager(minerManager);

            //this.Start();
            minerServer.ListenForMiners();

            Log.Information("[{0}] waiting for miners before connecting to pool..", poolWorkerName);
        }
예제 #2
0
 public void Start()
 {
     Log.Information("[{0}] Connecting to {1}.", this.poolWorkerName, this.poolEndPoint);
     poolClient.Connect(poolInstance.GetCurrentPool().poolAddress, poolInstance.GetCurrentPool().poolPort);
 }