예제 #1
0
 public void access(ErlConnect connect, ErlKVMessage message, ReceiveFun receiveFun, List<object> argus, long timeOut)
 {
     ByteBuffer data = new ByteBuffer();
     message.bytesWrite(data);
     //this._list.Add(new ErlEntry(connect, message.getPort(), receiveFun, argus, timeOut + TimeKit.getMillisTime()));
     connect.sendErl(data, 1, 1, 1, 1);
 }
예제 #2
0
    public void access(ErlConnect connect, ErlKVMessage message, ReceiveFun receiveFun, List <object> argus, long timeOut)
    {
        ByteBuffer data = new ByteBuffer();

        message.bytesWrite(data);
        _list.Add(new ErlEntry(connect, message.getPort(), receiveFun, argus, timeOut + TimeKit.getMillisTime()));
        connect.sendErl(data, ErlConnect.ENCRYPTION, ErlConnect.CRC, ErlConnect.COMPRESS, ErlConnect.KV);
        if (timeout == null)
        {
            timeout = TimerManager.Instance.getTimer(DELAY);
            timeout.addOnTimer(onTimer);
            timeout.start();
        }
    }
예제 #3
0
    public Boolean procCmd(int _port , BaseFPort fport)
    {
        if (needProcCmdDict.ContainsKey(_port)) {
            string cCmd = needProcCmdDict [_port];
            if (FilterCmdDict [cCmd]._count >= FilterCmdDict [cCmd]._beginCount) {
                String strValue = ConfigHelper.GetAppConfig (cCmd);
                ErlKVMessage msg = new ErlKVMessage ("r_ok");
                msg.addValue (null, new ErlInt (_port));
                ErlType[] et = StringKit.strToErlTypeArray (strValue);
                ErlArray ea = new ErlArray (et);
                msg.addValue ("msg", ea);
                Log.Info(msg.Cmd+"|"+ msg.toJsonString());
                ByteBuffer data = new ByteBuffer();
                //data.writeBytes (mybak);
                msg.bytesWrite(data);
                data.top = (int)data.bytesAvailable;
                byte[] tmpdata= new byte[(int)data.bytesAvailable];
                data.readBytes (tmpdata, 0, tmpdata.Length);

                fport.erlConnect.tmpBuffer.position = 0;
                Log.Info (fport.erlConnect.tmpBuffer) ;

                ByteBuffer tmp1 = new ByteBuffer();
                tmp1.writeBytes (tmpdata);
                //this.erlConnect.send (this.erlConnect.tmpBuffer);
                if (fport.erlConnect.socket.Connected) {
                    fport.send (fport.erlConnect, msg);
                } else {
                    Log.Info ("客户端已断开不再回传");
                }
                //base.erlConnect.socket.Send (bak);
                FilterCmdDict [cCmd]._count--;
                Log.Info ("处理完成的CMD[" + cCmd + "]");
                return true ;
            }

        }
        return false;
    }
예제 #4
0
 public void sendServer(ErlConnect connect, ErlKVMessage message, ReceiveFun receiveFun, List<object> argus, long timeOut)
 {
     ByteBuffer data = new ByteBuffer();
     message.bytesWrite(data);
     //Log.Info ("+++"+string.Concat (data.getArray ()));
     //this._list.Add(new ErlEntry(connect, message.getPort(), receiveFun, argus, timeOut + TimeKit.getMillisTime()));
     connect.sendErl(data, 1, 1, 1, 1);
 }