Пример #1
0
bool CCBuffer::isReadable(unsigned int u_len) const
{
	BEGIN_IF(LH(LE(_u_content_size, 0), LE(u_len, 0)))
	DO_RETURN_FLASE;
	END_IF
	DO_RETURN_R(LXE(CA(_u_read_pos, u_len), _u_content_size));
}
RTConnectionManager::ModuleInfo* RTConnectionManager::findConnectorInfoById(const std::string& userid)
{
    RTConnectionManager::ModuleInfo* pInfo = NULL;
    
    std::string connectorid;
    std::string sessionid;
    if (RTHiredisLocal::Instance()->CmdHGet(HI_USER_CONNECTOR_ID, userid, connectorid) && connectorid.length()>0) {
        TypeModuleSessionInfoLists* infoList = GetTypeModuleSessionInfo();
        TypeModuleSessionInfoLists::iterator it = infoList->begin();
        TypeModuleSessionInfo* t_pInfo = NULL;
        for (; it!=infoList->end(); it++) {
            t_pInfo = *it;
            if (t_pInfo && t_pInfo->moduleId.compare(connectorid) == 0) {
                sessionid = t_pInfo->sessionIds.front();
                LI("find transfer sessionid:%s", sessionid.c_str());
                break;
            }
        }
    } else {
        LE("RTHiredis CmdHGet error\n");
    }
    if (sessionid.length()>0) {
        pInfo = findModuleInfoBySid(sessionid);
    } else {
        LE("findConnectorInfoById sessionid is null\n");
    }
    
    return pInfo;
}
int	MRTMeeting::Start(const char*pConnIp, unsigned short usConnPort, const char*pDispIp, unsigned short usDispPort, const char* pHttpIp, unsigned short usHttpPort)
{
    Assert(g_inited);
    Assert(pConnIp != NULL && strlen(pConnIp)>0);
    Assert(pDispIp != NULL && strlen(pDispIp)>0);
    Assert(pHttpIp != NULL && strlen(pHttpIp)>0);
    char hh[24] = {0};
    sprintf(hh, "%s:%u", pHttpIp, usHttpPort);

    std::string mid;
    GenericSessionId(mid);
    MRTConnManager::Instance().SetMeetingId(mid);
    LI("[][]MeetingId:%s\n", mid.c_str());

    char addr[24] = {0};
    sprintf(addr, "%s %u", pConnIp, usConnPort);
    MRTConnManager::Instance().GetAddrsList()->push_front(addr);

    if (!(MRTConnManager::Instance().ConnectConnector())) {
        LE("Start to ConnectConnector failed\n");
        return -1;
    }

    if (!(MRTRoomManager::Instance().Init(pDispIp, usDispPort, pHttpIp, usHttpPort, hh))) {
        LE("Start to RoomManager Init failed\n");
        return -1;
    }

    return 0;
}
Пример #4
0
FILE *fopentmpfile(PCStr(path),int remove)
{	FILE *fp;
	int fd;

	if( isWindowsCE() ){
		fp = fopen_tmpfile(path);
		add_FILEY(FL_ARG,"fopentmpfile",fp);
	}else
	if( ACT_UNLINKABLE ){
		if( fp = fopen(path,FOPEN_RWB) )
			if( remove )
				unlink(path);
	}else{
		fd = newtmp(path);
		if( 0 <= fd ){
			if( fp = fdopen(fd,FOPEN_RWB) ){
				addtmp(fd,path);
				add_FILEY(FL_ARG,"fopentmpfile",fp);
				LV("fopentmpfile(%s) %x/%d",path,p2i(fp),fileno(fp));
			}else	LE("cannot fdopen(%d) %s",fd,path);
		}else{
			LE("cannot open tmpfile(%s)",path);
			fp = NULL;
		}
	}
	return fp;
}
Пример #5
0
DLLEXPORT void decode(int link_type UNUSED,const char *packet,unsigned len)
{
	unsigned int offset=0;
	int value;
	int more = 0;
	LE(value,20); 	printf(" MPLS: Label: %d\n",value);
	LE(value,3); 	printf(" MPLS: Class of service: %d\n",value);
	LE(value,1);	printf(" MPLS: Stack: %s\n",value?"Last" :"More");
	if (value == 0) more = 1;
	LE(value,8);	printf(" MPLS: TTL: %d\n",value);
	
	/* MPLS doesn't say what it's encapsulating, so we make an educated
	 * guess and pray.
	 */
	if (more)
		decode_next(packet+offset/8,len-4,"eth",0x8847);
	else if ((*(packet+4)&0xF0) == 0x40)
		decode_next(packet+offset/8,len-4,"eth",0x0800);
	else if ((*(packet+4)&0xF0) == 0x60)
		decode_next(packet+offset/8,len-4,"eth",0x86DD);
	else
		decode_next(packet+offset/8,len-4,"link",1);

	return;
}
//* For RTConnHttp
void CRTConnection::OnLogin(const char* pUserid, const char* pPass, const char* pNname)
{
    bool ok = false;
    {
        //check & auth
#if 0
        std::string pass;
        RTHiredisRemote::Instance().CmdGet(pUserid, pass);
        if (pass.compare(pPass)!=0) {
            LE("OnLogin pass not same redis error\n");
            return;
        }
#endif
        m_userId = pUserid;
        m_token = pPass;
        m_nname = pNname;
    }
    //if (ok) {
    if (false) {
        std::string sid;
        //store userid & pass
        CRTConnManager::ConnectionInfo* pci = new CRTConnManager::ConnectionInfo();
        if (pci) {
            GenericSessionId(sid);
            m_connectorId = CRTConnManager::Instance().ConnectorId();
            pci->_connId = sid;
            pci->_connAddr = CRTConnManager::Instance().ConnectorIp();
            pci->_connPort = CRTConnManager::Instance().ConnectorPort();
            pci->_userId = pUserid;
            pci->_token = pPass;
            pci->_pConn = NULL;
            pci->_connType = CONNECTIONTYPE::_chttp;
            pci->_flag = 1;
            std::string uid(pUserid);
            CRTConnManager::Instance().AddUser(CONNECTIONTYPE::_chttp, uid, pci);
        } else {
            LE("new ConnectionInfo error!!!\n");
        }
    } else {
        std::string uid(pUserid);
        CRTConnManager::ConnectionInfo* pci = NULL;
        CRTConnManager::Instance().AddUser(CONNECTIONTYPE::_chttp, uid, pci);
    }
    {
        // send response
        rapidjson::Document     jsonDoc;
        rapidjson::StringBuffer jsonStr;
        rapidjson::Writer<rapidjson::StringBuffer>   jsonWriter(jsonStr);
        jsonDoc.SetObject();
        if (ok) {
            jsonDoc.AddMember("login", "success", jsonDoc.GetAllocator());
        } else {
            jsonDoc.AddMember("login", "failed", jsonDoc.GetAllocator());
        }
        jsonDoc.Accept(jsonWriter);
        SendResponse(HPS_OK, jsonStr.GetString());
    }
}
Пример #7
0
/*
 * Convert character c to the corresponding 6-bit value. If character c
 * is not a Base64 character, then 0xFF (255) is returned.
 */
static unsigned b64_char_to_byte(int c) {
    unsigned x;

    x = (GE(c, 'A') & LE(c, 'Z') & (c - 'A')) |
        (GE(c, 'a') & LE(c, 'z') & (c - ('a' - 26))) |
        (GE(c, '0') & LE(c, '9') & (c - ('0' - 52))) | (EQ(c, '+') & 62) |
        (EQ(c, '/') & 63);
    return x | (EQ(x, 0) & (EQ(c, 'A') ^ 0xFF));
}
Пример #8
0
bool RTHiredis::HandleReply(redisReply* reply, std::string* res)
{
    switch (reply->type) {
        case REDIS_REPLY_STRING:
        {
            if (res) {
                res->assign(reply->str);
            } else {
                LI("reply str:%s\n", reply->str);
            }
        }
            break;
        case REDIS_REPLY_ARRAY:
        {
            LE("Is this Possible REPLY_ARRAY?\n");
        }
            break;
        case REDIS_REPLY_INTEGER:
        {
            if (res) {
                char c[12] = {0};
                sprintf(c, "%lld", reply->integer);
                res->assign(c);
            } else {
                LI("reply int:%lld\n", reply->integer);
            }
        }
            break;
        case REDIS_REPLY_NIL:
        {
            LI("reply nil\n");
        }
            break;
        case REDIS_REPLY_STATUS:
        {
            LI("reply status\n");
        }
            break;
        case REDIS_REPLY_ERROR:
        {
            if (res) {
                res->assign(reply->str);
            } else {
                LI("reply err:%s\n", reply->str);
            }
        }
            break;
        default:
        {
            LE("reply default handle\n");
        }
            break;
    }
    return true;
}
void MRTTransferSession::OnTypeConn(const std::string& str)
{
#if DEF_PROTO
    pms::ConnMsg c_msg;
    if (!c_msg.ParseFromString(str)) {
        LE("OnTypeConn c_msg.ParseFromString error\n");
    }
    LI("OnTypeConn connmsg--->:\n");
    //c_msg.PrintDebugString();

    if ((c_msg.conn_tag() == pms::EConnTag::THELLO)) {
        // when ME connector to other:
        if (c_msg.transferid().length()>0) {
            m_transferSessId = c_msg.transferid();
            {
                MRTConnManager::ModuleInfo* pmi = new MRTConnManager::ModuleInfo();
                if (pmi) {
                pmi->flag = 1;
                pmi->othModuleType = c_msg.tr_module();
                pmi->othModuleId = m_transferSessId;
                pmi->pModule = this;
                //bind session and transfer id
                MRTConnManager::Instance().AddModuleInfo(pmi, m_transferSessId);
                //store which moudle connect to this connector
                MRTConnManager::Instance().AddTypeModuleSession(c_msg.tr_module(), c_msg.moduleid(), m_transferSessId);
                LI("store other moduleid:%s, transfersessionid:%s\n", c_msg.moduleid().c_str(), m_transferSessId.c_str());
                } else {
                    LE("new ModuleInfo error\n");
                }
            }
            pms::TransferMsg t_msg;

            c_msg.set_tr_module(pms::ETransferModule::MMEETING);
            c_msg.set_conn_tag(pms::EConnTag::THELLOHI);
            c_msg.set_transferid(m_transferSessId);
            //send self module id to other
            c_msg.set_moduleid(MRTConnManager::Instance().MeetingId());

            t_msg.set_type(pms::ETransferType::TCONN);
            t_msg.set_flag(pms::ETransferFlag::FNEEDACK);
            t_msg.set_priority(pms::ETransferPriority::PHIGH);
            t_msg.set_content(c_msg.SerializeAsString());

            std::string s = t_msg.SerializeAsString();
            SendTransferData(s.c_str(), (int)s.length());

        } else {
            LE("Connection id:%s error!!!\n", c_msg.transferid().c_str());
        }
    }
#else
    LE("not define DEF_PROTO\n")
#endif
}
Пример #10
0
int	RTMsgQueue::Start(const char*pConnIp, unsigned short usConnPort, const char*pModuleIp, unsigned short usModulePort)
{
	Assert(g_inited);
	Assert(pConnIp != NULL && strlen(pConnIp)>0);
	Assert(pModuleIp != NULL && strlen(pModuleIp)>0);
    
    RTHiredisLocal::Instance()->Connect();
    std::string mid;
    RTConnectionManager::Instance()->GenericSessionId(mid);
    RTConnectionManager::Instance()->SetMsgQueueId(mid);
    LI("[][]MsgQueueId:%s\n", mid.c_str());
    
	if(usConnPort == 0)
	{
		LE("MsgQueue server need usConnPort...!");
		Assert(false);
	}

	if(usConnPort > 0)
	{
        char addr[24] = {0};
        sprintf(addr, "%s %u", pConnIp, usConnPort);
        RTConnectionManager::Instance()->GetAddrsList()->push_front(addr);
        
        if (!(RTConnectionManager::Instance()->ConnectConnector())) {
            LE("Start to ConnectConnector failed\n");
            return -1;
        }
	}
    
    if(usModulePort == 0)
	{
		LE("MsgQueue server need usModulePort...!!");
		Assert(false);
	}

	if(usModulePort > 0)
	{
        m_pModuleListener = new RTModuleListener();
        OS_Error err = m_pModuleListener->Initialize(INADDR_ANY, usModulePort);
        if (err!=OS_NoErr)
        {
            LE("CreateMeetingListener error port=%d \n", usModulePort);
            delete m_pModuleListener;
            m_pModuleListener=NULL;
            return -1;
        }
        LI("Start MsgQueue service meet:(%d) ok...,socketFD:%d\n", usModulePort, m_pModuleListener->GetSocketFD());
        m_pModuleListener->RequestEvent(EV_RE);
	}
    
   return 0;
}
bool point_in_rectangle(const point &p, const point &v, double w, double h) {
  static const bool EDGE_IS_INSIDE = true;
  if (w < 0) {
    return point_in_rectangle(p, point(v.x + w, v.y), -w, h);
  }
  if (h < 0) {
    return point_in_rectangle(p, point(v.x, v.y + h), w, -h);
  }
  return EDGE_IS_INSIDE
      ? (GE(p.x, v.x) && LE(p.x, v.x + w) && GE(p.y, v.y) && LE(p.y, v.y + h))
      : (GT(p.x, v.x) && LT(p.x, v.x + w) && GT(p.y, v.y) && LT(p.y, v.y + h));
}
bool CRTTransferSession::Connect(const std::string addr, int port)
{
    if (addr.empty() || port < 2048) {
        LE("%s invalid params addr:%s, port:%d\n", __FUNCTION__, addr.c_str(), port);
        return false;
    }
    OS_Error err = GetSocket()->Connect(SocketUtils::ConvertStringToAddr(addr.c_str()), port);
    if (err == OS_NoErr || err == EISCONN) {
        return true;
    } else {
        LE("%s ERR:%d\n", __FUNCTION__, err);
        return false;
    }
}
bool MRTTransferSession::Connect()
{
    if (m_addr.empty() || m_port < 2048) {
        LE("%s invalid params addr:%s, port:%d\n", __FUNCTION__, m_addr.c_str(), m_port);
        return false;
    }
    OS_Error err = GetSocket()->Connect(SocketUtils::ConvertStringToAddr(m_addr.c_str()), m_port);
    if (err == OS_NoErr || err == EISCONN) {
        m_connectingStatus = 1;
        return true;
    } else {
        LE("%s ERR:%d\n", __FUNCTION__, err);
        return false;
    }
}
void RTConnectionTcp::OnSndMsg(MSGTYPE mType, long long mseq, const char* pUserid, const char* pData, int dLen)
{
    if (!pData) {
        LE("%s invalid params\n", __FUNCTION__);
        std::string resp;
        GenericResponse(SIGNALTYPE::reqsndmsg, mType, mseq, RTCommCode::_invparams, GetRTCommStatus(RTCommCode::_invparams), resp);
        SendResponse(0, resp.c_str());
        return;
    }
    
    //no matter mType is meet or callcenter or p2p or others
    //the following code should be same
    //find an TrasnferSession By mtype
    //transfer msg by TransferSession
    
    TRANSFERMSG t_trmsg;
    TRANSMSG t_msg;
    t_msg._flag = 0;
    t_msg._touser = "";
    t_msg._connector = RTConnectionManager::Instance()->ConnectorId();
    t_msg._content = pData;
    
    t_trmsg._action = TRANSFERACTION::req;
    t_trmsg._fmodule = TRANSFERMODULE::mconnector;
    t_trmsg._type = TRANSFERTYPE::trans;
    t_trmsg._trans_seq = GenericTransSeq();
    t_trmsg._trans_seq_ack = 0;
    t_trmsg._valid = 1;
    t_trmsg._content = t_msg.ToJson();
    
    const std::string s = t_trmsg.ToJson();
    RTConnectionManager::ModuleInfo* pmi = RTConnectionManager::Instance()->findModuleInfo(pUserid, (TRANSFERMODULE)mType);
    if (pmi && pmi->pModule) {
        pmi->pModule->SendTransferData(s.c_str(), (int)s.length());
    } else {
        LE("pmi->pModule is NULL\n");
        std::string resp;
        GenericResponse(SIGNALTYPE::reqsndmsg, mType, mseq, RTCommCode::_errmoduinfo, GetRTCommStatus(RTCommCode::_errmoduinfo), resp);
        SendResponse(0, resp.c_str());
        return;
    }
    {
        std::string resp;
        GenericResponse(SIGNALTYPE::reqsndmsg, mType, mseq, RTCommCode::_ok, GetRTCommStatus(RTCommCode::_ok), resp);
        SendResponse(0, resp.c_str());
        return;
    }
}
Пример #15
0
const char* RTConnHttp::GenerateRequest(http_method method, const std::string& path, const std::string& data, int &outLen) const
{
    if (path.length()==0) {
        LE("params error!!!\n");
        outLen = 0;
        return "";
    }
    
    http_message *httpMsg = http_generator_create(HTTP_REQUEST);
    
    http_generator_set_method(httpMsg, method);
    http_generator_set_path(httpMsg, path.c_str(), (int)path.length());
    http_generator_add_header(httpMsg, HPR_HOST, m_host.c_str(), (int)m_host.length());
    http_generator_add_header(httpMsg, HPR_ACCEPT, "application/json", 16);
    
    if(data.length()>0)
    {
        http_generator_set_content(httpMsg, data.c_str(), (int)data.length(), "application/x-www-form-urlencoded");
    }
    
    int nLen = 0;
    char* pMsg = http_generator_tostring(httpMsg, &nLen);
    outLen = nLen;
    
    http_generator_destroy(httpMsg);
    httpMsg = NULL;
    
    return pMsg;
}
Пример #16
0
int RTConnHttp::ProcessData(const char*pData, int nLen)
{
	int parsed = 0;
	enum http_errno err;
	while (parsed < nLen)
	{
		const char* pMsg = pData + parsed;
		int msgLen = nLen - parsed;
		int nlen = do_http_parse(HTTP_RESPONSE, (char *)pMsg, msgLen, &err, &RTConnHttp::OnParsedHttpMessage, this);
		parsed += nlen;
		if (err != HPE_OK)
		{
            LE("do_http_parse error!!!!!!\n");
			parsed = nLen;
			break;
		}
		else if (nlen == 0)
		{
			break;
		}
		else
		{
			//LI(">Recv:%.*s \r\n", parsed, pMsg);
		}
	}

	return parsed;
}
Пример #17
0
void RTHiredis::CmdPing()
{
    if (!m_redisContext) {
        return;
    }
    redisReply* m_redisReply = (redisReply*)redisCommand(m_redisContext, "PING");
    if (!m_redisReply || m_redisReply->type == REDIS_REPLY_ERROR) {
        LE("redis run error\n");
        if (m_redisReply) {
            LE("error::%s\n", m_redisReply->str);
        }
        return;
    }
    printf("CmdPing reply:%s\n", m_redisReply->str);
    freeReplyObject((void*)m_redisReply);
}
Пример #18
0
int RTTransfer::ProcessData(const char* pData, int nLen)
{
    int parsed = 0;
    int ll = 0;
    LI("RTConnTcp::ProcessData pData:%s\n", pData);
    while (parsed < nLen)
    {
        const char* pMsg = pData + parsed;
        int offset = 0;
        if (*(pMsg+offset) == '$') {
            offset += 1;
            char l[4] = {0};
            memcpy(l, pMsg+offset, 4);
            offset += 4;
            ll = (int)strtol(l, NULL, 10);
            if (ll>=0 && ll <= nLen) { // the message length may be 0
                int nlen = DoProcessData((char *)(pMsg+offset), ll);
                LI("Transfer DoProcessData msg nlen:%d, ll:%d\n", nlen, ll);
                if (nlen < 0) {
                    break;
                } else { // nlen < 0
                    assert(nlen == ll);
                    offset += ll;
                    parsed += offset;
                }
            } else { // ll>0 && ll <= nLen
                LE("Get Msg Len Error!!!\n");
            }
        }
    }
    return parsed;
}
Пример #19
0
/** Creates the buffers and sets up the rest od the object */
HRESULT EditorLinePrimitive::CreatePrimitive(LineVertex* PrimVerts, UINT NumVertices, D3D11_PRIMITIVE_TOPOLOGY Topology)
{
	HRESULT hr=S_OK;

	// Clean up previous data
	DeleteContent();

	// Copy over the new data
	Vertices = new LineVertex[NumVertices];
	memcpy(Vertices, PrimVerts, sizeof(LineVertex)*NumVertices);
	this->NumVertices = NumVertices;
	
	//Create the vertex buffer
	D3D11_BUFFER_DESC bufferDesc;
    bufferDesc.ByteWidth = NumVertices * sizeof(LineVertex);
    bufferDesc.Usage = D3D11_USAGE_DEFAULT;
    bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
    bufferDesc.CPUAccessFlags = 0;
    bufferDesc.MiscFlags = 0;

	D3D11_SUBRESOURCE_DATA InitData;
    InitData.pSysMem = &Vertices[0];
	InitData.SysMemPitch = 0;
	InitData.SysMemSlicePitch = 0;

	D3D11GraphicsEngineBase* engine = (D3D11GraphicsEngineBase*)Engine::GraphicsEngine;

	LE(engine->GetDevice()->CreateBuffer(&bufferDesc,&InitData,&PrimVB));

	PrimitiveTopology = Topology;

	return hr;
}
Пример #20
0
node* join_trees(node* n1, node* n2) {

  node* lowest_n;
  node* highest_n;

  if (LE(n1->key, n2->key)) {
    lowest_n = n1;
    highest_n = n2;
  } else {
    lowest_n = n2;
    highest_n = n1;
  }

  if (lowest_n->child == NULL) {
      lowest_n->child = highest_n;
      highest_n->parent = lowest_n;
  } else {
    concat_list(lowest_n->child, highest_n);
    node* temp_ref = highest_n;
    do {
      temp_ref->parent = lowest_n;
      temp_ref = temp_ref->right_sibling;
    } while (temp_ref != highest_n);
  }
  lowest_n->rank = lowest_n->rank + 1;
  highest_n->marked = 0;
  return lowest_n;
}
Пример #21
0
bool SymbolJudger::loadSymbols(const char *filename)
{
	if (m_loaded) return 1;
	m_loaded = 1;
	if (trie == NULL) 
	{
		LE("trie is NULL. Failed to load symbal");
		return 0;
	}
	FILE *fp = fopen(filename, "r");
	if (!fp)
	{
		LERR("open file %s failed!", filename);
		return 0;
	}
	char s[LEN];
	while (fgets(s, LEN, fp))
	{
		int len = strlen(s);
		s[--len] = '\0';
		bool ret = trie->insert(s, len, 1);
		if (!ret) return 0;
	}
	return 1;
}
Пример #22
0
bool CCBuffer::isReadable() const
{
	BEGIN_IF(LE(_u_content_size, 0))
	DO_RETURN_FLASE;
	END_IF
	DO_RETURN_R(LX(_u_read_pos, _u_content_size));
}
Пример #23
0
bool RTHiredis::CmdHExists(const std::string hid, const std::string key, std::string& res)
{
    if (!m_redisContext || hid.empty() || key.empty()) {
        return false;
    }
    redisReply* m_redisReply = (redisReply*)redisCommand(m_redisContext, "HEXISTS %s %s", hid.c_str(), key.c_str());
    if (!m_redisReply || m_redisReply->type == REDIS_REPLY_ERROR) {
        LE("redis run error\n");
        if (m_redisReply) {
            LE("error::%s\n", m_redisReply->str);
        }
        return false;
    }
    HandleHReply(m_redisReply, NULL);
    freeReplyObject((void*)m_redisReply);
    return true;
}
Пример #24
0
bool RTHiredis::CmdSet(const std::string key, const std::string value)
{
    if (!m_redisContext || key.empty() || value.empty()) {
        return false;
    }
    redisReply* m_redisReply = (redisReply*)redisCommand(m_redisContext, "SET %s %s", key.c_str(), value.c_str());
    if (!m_redisReply || m_redisReply->type == REDIS_REPLY_ERROR) {
        LE("redis run error\n");
        if (m_redisReply) {
            LE("error::%s\n", m_redisReply->str);
        }
        return false;
    }
    printf("CmdSet reply:%s\n", m_redisReply->str);
    freeReplyObject((void*)m_redisReply);
    return true;
}
Пример #25
0
bool RTHiredis::CmdHVals(const std::string hid, std::list<const std::string>* ress)
{
    if (!m_redisContext || hid.empty()) {
        return false;
    }
    redisReply* m_redisReply = (redisReply*)redisCommand(m_redisContext, "HVALS %s", hid.c_str());
    if (!m_redisReply || m_redisReply->type == REDIS_REPLY_ERROR) {
        LE("redis run error\n");
        if (m_redisReply) {
            LE("error::%s\n", m_redisReply->str);
        }
        return false;
    }
    HandleHReply(m_redisReply, ress);
    freeReplyObject((void*)m_redisReply);
    return true;
}
void RTConnectionTcp::ConnectionDisconnected()
{
    if (m_userId.length()) {
        LI("RTConnectionTcp::ConnectionDisconnected DelUser m_userId:%s\n", m_userId.c_str());
        RTConnectionManager::Instance()->ConnectionLostNotify(m_userId);
    } else {
        LE("RTConnectionTcp::ConnectionDisconnected m_userId.length is 0\n");
    }
}
      std::shared_ptr<Expr> buildTpchQ6FilterExpression() {
        shared_ptr<Expr> expression(AND(GE(FIELD("l_shipdate"), CONST("1994-01-01")),
                                          LT(FIELD("l_shipdate"), CONST("1995-01-01")),
                                          GE(FIELD("l_discount"), CONST("0.05", DOUBLE)),
                                          LE(FIELD("l_discount"), CONST("0.07", DOUBLE)),
                                          LT(FIELD("l_quantity"), CONST("24", DOUBLE))
                                         ));

        return expression;
      }
void CRTConnection::ConnectionDisconnected()
{
    if (m_userId.length()) {
        std::string token;
        CRTConnManager::Instance().DelUser(CONNECTIONTYPE::_chttp, m_userId, token);
        CRTConnManager::Instance().ConnectionLostNotify(m_userId, m_token);
    } else {
        LE("RTConnection::ConnectionDisconnected m_userId.length is 0\n");
    }
}
/**
* Creates the inputlayout using the given input decleration
*/
bool RD3D11InputLayout::CreateInputLayoutAPI(RVertexShader* vertexshadertemplate)
{
	HRESULT hr;

	// Create inputlayout
	LE(REngine::RenderingDevice->GetDevice()->CreateInputLayout((D3D11_INPUT_ELEMENT_DESC*)InputElementDesc, NumInputDescElements, vertexshadertemplate->GetShaderData()->GetBufferPointer(),
		vertexshadertemplate->GetShaderData()->GetBufferSize(), &InputLayout));

	return hr == S_OK;
}
void LRTGroupSession::OnLogin(pms::EServerCmd cmd, pms::EModuleType module, const std::string& msg)
{
    LI("%s was called\n", __FUNCTION__);
    pms::Login login;
    if (!login.ParseFromString(msg)) {
        LE("login.ParseFromString error\n");
    }

    m_userid = login.usr_from();
    m_token = login.usr_token();
    LI("Onlogin user:%s login\n", m_userid.c_str());
    std::string sid;
    {
        //store userid & pass
        LRTConnManager::ConnectionInfo* pci = new LRTConnManager::ConnectionInfo();
        if (pci) {
            GenericSessionId(sid);
            pci->_connId = sid;
            pci->_userId = m_userid;
            pci->_token = m_token;
            pci->_pConn = this;
            pci->_connType = pms::EConnType::TTCP;
            pci->_flag = 1;
            LRTConnManager::Instance().AddUser(pms::EConnType::TTCP, m_userid, pci);
            //LRTConnManager::Instance().ConnectionConnNotify(m_userId, m_token);

            // send response
            std::string resp;
            GenericResponse(pms::EServerCmd::CLOGIN, module, 0, resp);
            SendResponse(0, resp.c_str());
            m_login = true;
            return;
        } else {
            LE("new ConnectionInfo error userid:%s\n", m_userid.c_str());
            std::string resp;
            GenericResponse(pms::EServerCmd::CLOGIN, module, 101, resp);
            SendResponse(0, resp.c_str());
            m_login = false;
            return;
        }
    }
}