Пример #1
0
bool cpiFloodprot::OnUserLogin(cUser *user)
{
	if(!mFloodprotect->AddConn(user->mxConn, 1))
	{
		string omsg("Sorry, the limit of unregistered connections with your ip has been exceeded.");
		user->mxConn->Send(omsg,true);
		user->mxConn->CloseNice(500); // not sure if this is needed
		return false;
	}
	return true;
}
Пример #2
0
bool cpiFloodprot::OnNewConn(cConnDC *conn)
{
	if(!mFloodprotect->AddConn(conn, 1))
	{
		string omsg("Sorry, the limit of connections with your ip has been exceeded.");
		conn->Send(omsg,true);
		conn->CloseNice(500); // not sure if this is needed
		return false;
	}
	return true;
}
Пример #3
0
RESULT_T apoCli_sendMsg(int messageId, void *messageBody, int bodySize)
{
	NDOStreamMsg omsg((NDUINT16) messageId);
	if (messageBody && bodySize > 0) {
		if (-1 == omsg.WriteStream((char*)messageBody, bodySize)) {
			return NDSYS_ERR_INVALID_INPUT;
		}
	}
	
	ApoClient *apoCli = ApoClient::getInstant();
	if (apoCli)	{
		if (!apoCli->IsInConnect())	{
			nd_logerror("can not send data, MUST LOGIN \n") ;
			return NDSYS_ERR_NEED_LOGIN;
		}

		nd_connector_send(apoCli->getConn(), &(omsg.GetMsgAddr()->msg_hdr.packet_hdr), 0);
		return ESERVER_ERR_SUCCESS;
	}
	return NDSYS_ERR_NOT_INIT;
}