本文整理汇总了C++中Ref::Insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Ref::Insert方法的具体用法?C++ Ref::Insert怎么用?C++ Ref::Insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ref
的用法示例。
在下文中一共展示了Ref::Insert方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleUserLogin
Ref< User > HandleUserLogin(RakPeerInterface* rakServer, Packet* packet, CONNECT_INFO* cfg, Ref< UsersPool > OnlineUsers) {
if (packet->data[3] == LOGIN_REQUEST) { // thats just a formality so far since no other numbers occured for this case
std::string username, password;
// Get the username of the user that logged in...
if (packet->length > 0x8) { // This is where username always starts
int i = 0;
while (packet->data[0x8 + i] != '\0' && packet->length > (uint)(0x8 + i)) {
username.push_back(packet->data[8 + i]);
i += 2;
}
}
// Get the password of the user the logged in...
if (packet->length > 0x4a) { // This is where password starts
int i = 0;
while (packet->data[0x4a + i] != '\0' && packet->length > (uint)(0x4a + i)) {
password.push_back(packet->data[0x4a + i]);
i += 2;
}
}
// Login the user to the server
auto usr = User::Login(username, password, packet->systemAddress);
// Send the character success packet (while making sure user is not null)
if (usr == NULL) {
Logger::log("AUTH", "", "USER IS NULL!!!!");
UserSuccess successChar = UserSuccess::INVALID_USER;
SendStatusPacket(rakServer, packet->systemAddress, successChar, cfg->redirectIp, cfg->redirectPort, 320);
} else {
UserSuccess successChar = (UserSuccess)usr->successState;
SendStatusPacket(rakServer, packet->systemAddress, successChar, cfg->redirectIp, cfg->redirectPort, 320);
if (successChar == UserSuccess::SUCCESS) {
// If the login was a success, insert the user into the UsersPool
OnlineUsers->Insert(usr, packet->systemAddress);
// Also register the client with the session table
// TODO: Integrate UserPool into Session Table
Session::login(packet->systemAddress, usr->GetID());
//SessionsTable::login(usr->GetID(), packet->systemAddress);
}
return usr;
}
}
return NULL;
}
示例2: HandleUserLogin
Ref< User > HandleUserLogin(RakPeerInterface* rakServer, Packet* packet, CONNECT_INFO* cfg, Ref< UsersPool > OnlineUsers) {
if (packet->data[3] == 0) { // thats just a formality so far since no other numbers occured for this case
// response: 05, 00
string username, password;
// get the username just for fun
if (packet->length > 0x8) { // this is where username always starts (how many bytes are reserved for it in the packet?)
int i = 0;
while (packet->data[0x8 + i] != '\0' && packet->length > (uint)(0x8 + i)) {
username.push_back(packet->data[8 + i]);
i += 2;
}
}
// get the password just for fun
if (packet->length > 0x4a) { // this is where password starts (how many bytes are reserved for it in the packet?)
int i = 0;
while (packet->data[0x4a + i] != '\0' && packet->length > (uint)(0x4a + i)) {
password.push_back(packet->data[0x4a + i]);
i += 2;
}
}
auto usr = User::Login(username, password, packet->systemAddress);
// we could do a login check here and then send the according response but as long as we use predefined data to send away its not worth the trouble
if (usr == NULL) { // very simple check
auto v = OpenPacket(".\\auth\\auth_aw_login_bad.bin");
ServerSendPacket(rakServer, v, packet->systemAddress);
return NULL;
} else {
OnlineUsers->Insert(usr, packet->systemAddress);
// 0x159 is where IP to redirect to starts (don't know how much bytes are reserved for it in the packet, I would imagine 16
// but since there was always a great zero gap until the port in all these captured packets its nothing to worry about (yet)
auto v = OpenPacket(".\\auth\\auth_aw_login_ok.bin");
if (v.size() > 0) {
if (v.size() > 0x19B) { // 0x19B is port (2 bytes reserved or more?)
if (cfg->redirectIp[0] != 0)
memcpy(v.data() + 0x159, cfg->redirectIp, sizeof(cfg->redirectIp));
if (cfg->redirectPort > 0)
memcpy(v.data() + 0x19B, &cfg->redirectPort, sizeof(cfg->redirectPort));
}
ServerSendPacket(rakServer, v, packet->systemAddress);
}
return usr;
}
}
return NULL;
}
示例3: AuthLoop
void AuthLoop(CONNECT_INFO* cfg, Ref< UsersPool > OnlineUsers, Ref< CrossThreadQueue< std::string > > OutputQueue) {
// Initialize the RakPeerInterface used throughout the entire server
RakPeerInterface* rakServer = RakNetworkFactory::GetRakPeerInterface();
// Initialize the PacketFileLogger plugin (for the logs)
PacketFileLogger* msgFileHandler = NULL;
if (cfg->logFile) {
msgFileHandler = new PacketFileLogger();
rakServer->AttachPlugin(msgFileHandler);
}
// Initialize security IF user has enabled it in config.ini
InitSecurity(rakServer, cfg->useEncryption);
// Initialize the SocketDescriptor
SocketDescriptor socketDescriptor(cfg->listenPort, 0);
// If the startup of the server is successful, print it to the console
// Otherwise, print an error
if (rakServer->Startup(8, 30, &socketDescriptor, 1)) {
std::stringstream s;
s << "[AUTH] started! Listening on: " << cfg->listenPort << "\n";
OutputQueue->Insert(s.str());
} else QuitError("[AUTH] server init error!");
// Set max incoming connections to 8
rakServer->SetMaximumIncomingConnections(8);
// If msgFileHandler is initalized, use it to log the server in ./logs/auth
if (msgFileHandler != NULL) msgFileHandler->StartLog(".\\logs\\auth");
// Initialize the Packet class
Packet* packet;
//LUNI_AUTH = true;
// LUNIterminate is the bool used to terminate threads.
// While it is false, the thread runs, but if it is true, the thread exits
while (!getTerminate()) {
RakSleep(30); // This sleep keeps RakNet responsive
packet = rakServer->Receive(); // Get the packets from the client
if (packet == NULL) continue; // If the packet is null, just continue without processing anything
PrintPacketInfo(packet, msgFileHandler); // Print the packet information (if packet is not NULL)
// Figure out which packet it is...
switch (packet->data[0]) {
case ID_LEGO_PACKET:
switch (packet->data[1]) {
case GENERAL:
if (packet->data[3] == 0) {
// Send the Init packet to the client
SendInitPacket(rakServer, packet->systemAddress, true);
}
break;
case AUTH: //user logging into server
{
// Handle the user login using the above method
auto usr = HandleUserLogin(rakServer, packet, cfg, OnlineUsers);
// If username is not null, print the username that logged in.
// Otherwise, print the error message
if (usr != NULL) {
Logger::log("AUTH", "", usr->GetUsername() + " Logged-in");
}
else Logger::log("AUTH", "", "Login failed");
}
break;
// The default if the packet the server is recieving has an unidentified ID
default:
Logger::log("AUTH", "", "received unknown packet: " + RawDataToString(packet->data, packet->length));
}
break;
// If the server is recieving a new connection, print it.
case ID_NEW_INCOMING_CONNECTION:
# ifdef DEBUG
Logger::log("AUTH", "" , "is receiving a new connection...");
#endif
break;
// If someone is disconnecting from the auth server, print it
case ID_DISCONNECTION_NOTIFICATION:
Logger::log("AUTH", "", "User disconnected from Auth server...");
Session::disconnect(packet->systemAddress, SessionPhase::PHASE_CONNECTED);
break;
// If the packet has an unidentified RakNet ID (one not listed here), print the
// packet info
default:
Logger::log("AUTH", "", "received unknown packet: " + RawDataToString(packet->data, packet->length));
}
// Deallocate the packet to conserve memory
rakServer->DeallocatePacket(packet);
}
//.........这里部分代码省略.........
示例4: CharactersLoop
void CharactersLoop(CONNECT_INFO* cfg, Ref< UsersPool > OnlineUsers, Ref< CrossThreadQueue< string > > OutputQueue) {
RakPeerInterface* rakServer = RakNetworkFactory::GetRakPeerInterface();
PacketFileLogger* msgFileHandler = NULL;
if (cfg->logFile) {
msgFileHandler = new PacketFileLogger();
rakServer->AttachPlugin(msgFileHandler);
}
InitSecurity(rakServer, cfg->useEncryption);
SocketDescriptor socketDescriptor(cfg->listenPort, 0);
if (rakServer->Startup(8, 30, &socketDescriptor, 1)) {
stringstream s;
s << "characters started! Listening on: " << cfg->listenPort << "\n";
OutputQueue->Insert(s.str());
} else exit(2);
rakServer->SetMaximumIncomingConnections(8);
if (msgFileHandler != NULL) msgFileHandler->StartLog(".\\logs\\char");
Packet* packet;
while (!LUNIterminate) {
RakSleep(30); // This sleep keeps RakNet responsive
packet = rakServer->Receive();
if (packet == NULL) continue;
PrintPacketInfo(packet, msgFileHandler);
// create and send packets back here according to the one we got
switch (packet->data[0]) {
case ID_LEGO_PACKET:
switch (packet->data[1]) {
case LUNI_INITAW:
if (packet->data[3] == 0) { // thats just a formality so far since no other numbers occured for this case
auto v = OpenPacket(".\\char\\init_aw.bin");
ServerSendPacket(rakServer, v, packet->systemAddress);
}
break;
case LUNI_CHARACTER:
switch (packet->data[3]) {
case LUNI_CHARACTER_CHARSDATA: // char response: 05, 06
// char traffic only - byte 8 defines number of characters, if there are no characters the user automatically gets to the character creation screen
{
//giving client characters list
auto v = OpenPacket(".\\char\\char_aw2.bin");
ServerSendPacket(rakServer, v, packet->systemAddress);
#ifdef DEBUG
/*StringCompressor* sc = StringCompressor::Instance();
Ref<char> output = new char[256];
RakNet::BitStream* bs = new RakNet::BitStream(v.data(), v.size(), false);
if (sc->DecodeString(output.Get(), 256, bs))
cout << ("\n the TEST: " + RawDataToString((uchar*)output.Get(), 256) + "\n");
else cout << ("\n the Test failure :(\n");*/
RakNet::BitStream bs(v.data(), v.size(), false);
vector< uchar > out(v.size() *2);
bs.ReadCompressed(out.data(), out.size(), true);
//cout << "\n the Test: " << RawDataToString( s.Get(), v.size() ) << endl;
//SavePacket("theTest.bin", out);
#endif
}
break;
case LUNI_CHARACTER_CREATEDNEW:
{
CharacterCreation cc(CleanPacket(packet->data, packet->length));
stringstream s;
s << "\nSomebody wants to create a character with name: " << cc.GetName() << endl;
s << "re-Serialization: " << RawDataToString(cc.Serialize(), cc.GetGeneratedPacketSize()) << endl;
OutputQueue->Insert(s.str());
// response: 05, 06
// since we can't build our own packets yet we can't send a response here (because it is dependent on the user input)
vector< uchar > reply(2);
reply.push_back(5);
reply.push_back(6);
ServerSendPacket(rakServer, reply, packet->systemAddress);
}
break;
case 4: // is this sent from the client once the user wants to enter world?
{
auto usr = OnlineUsers->Find(packet->systemAddress);
if (usr != NULL) {
usr->numredir++;
//character id is received
vector< uchar > t;
for (int i = 8; i <= 11; i++) t.push_back(packet->data[i]);
usr->nextcid = *(ulong*)t.data();
#ifdef DEBUG
stringstream s;
s << "\nCharacter logging in world with id: " << usr->nextcid;
if ( usr->nextcid == 2397732190 ) s << " CheekyMonkey!\n";
else if ( usr->nextcid == 2444680020 ) s << " monkeybrown!\n";
else if ( usr->nextcid == 1534792735 ) s << " GruntMonkey!\n";
//.........这里部分代码省略.........
示例5: WorldLoop
void WorldLoop(CONNECT_INFO* cfg, Ref< UsersPool > OnlineUsers, Ref< CharactersPool> OnlineCharacters, Ref< CrossThreadQueue< string > > OutputQueue) {
// Initialize the RakPeerInterface used throughout the entire server
rakServer = RakNetworkFactory::GetRakPeerInterface();
// Initialize the PacketFileLogger plugin (for the logs)
PacketFileLogger* msgFileHandler = NULL;
if (cfg->logFile) {
msgFileHandler = new PacketFileLogger();
rakServer->AttachPlugin(msgFileHandler);
}
// Initialize security IF user has enabled it in config.ini
InitSecurity(rakServer, cfg->useEncryption);
// Initialize the SocketDescriptor
SocketDescriptor socketDescriptor(cfg->listenPort, 0);
// If the startup of the server is successful, print it to the console
// Otherwise, quit the server (as the char server is REQUIRED for the
// server to function properly)
if (rakServer->Startup(8, 30, &socketDescriptor, 1)) {
stringstream s;
s << "world started! Listening on: " << cfg->listenPort << "\n";
OutputQueue->Insert(s.str());
} else exit(2);
rakServer->SetNetworkIDManager(&networkIdManager);
rakServer->AttachPlugin(&replicaManager);
networkIdManager.SetIsNetworkIDAuthority(true);
// Attach the ReplicaManager2
replicaManager.SetAutoSerializeInScope(true);
replicaManager.SetAutoParticipateNewConnections(true);
replicaManager.SetAutoConstructToNewParticipants(true);
// Set max incoming connections to 8
rakServer->SetMaximumIncomingConnections(8);
// If msgFileHandler is not NULL, save logs of char server
if (msgFileHandler != NULL) msgFileHandler->StartLog(".\\logs\\world");
// Initialize the Packet class for the packets
Packet* packet;
// This will be used in the saving of packets below
int i = 0;
ZoneId zone = NIMBUS_ISLE;
// This will be used in the saving of packets below...
while (!LUNIterminate) {
RakSleep(30); // This sleep keeps RakNet responsive
packet = rakServer->Receive(); // Recieve the packets from the server
if (packet == NULL) continue; // If packet is NULL, just continue without processing anything
// This will save all packets recieved from the client if running from DEBUG
#ifdef DEBUG
stringstream packetName;
packetName << ".//Saves//World_Packet" << i << ".bin";
if (packet->data[3] != 22) {
SavePacket(packetName.str(), (char*)packet->data, packet->length);
i++;
}
#endif
// Create and send packets back here according to the one we got
switch (packet->data[0]) {
case ID_USER_PACKET_ENUM:
switch (packet->data[1]) {
case GENERAL:
if (packet->data[3] == 0) { // thats just a formality so far since no other numbers occured for this case
auto v = OpenPacket(".\\worldTest\\init_aw2.bin");
ServerSendPacket(rakServer, v, packet->systemAddress);
}
break;
case WORLD:
switch (packet->data[3]) {
case CLIENT_VALIDATION:
{
auto usr = OnlineUsers->Find(packet->systemAddress);
//this packets contains ZoneId and something else... but what?
// it starts whit: 53 05 00 02 00 00 00 00 -- -- (<-ZoneId) ?? ?? ??
vector< uchar > v;
/*if (usr != NULL && usr->nextcid == 2444680020) { //monkeybrown
v = OpenPacket(".\\world\\monkeybrown\\char_aw2.bin");
}
else if (usr != NULL && usr->nextcid == 1534792735) { //gruntmonkey
v = OpenPacket(".\\world\\gruntmonkey\\char_aw2.bin");
}
else if (usr != NULL && usr->nextcid == 1457240027) { //shafantastic
v = OpenPacket(".\\world\\shastafantastic\\char_aw22.bin");
}
else { //cheekymonkey
v = OpenPacket(".\\world\\char_aw2.bin");
}*/
//.........这里部分代码省略.........
示例6: CharactersLoop
void CharactersLoop(CONNECT_INFO* cfg, Ref< UsersPool > OnlineUsers, Ref< CrossThreadQueue< string > > OutputQueue) {
// Initialize the RakPeerInterface used throughout the entire server
RakPeerInterface* rakServer = RakNetworkFactory::GetRakPeerInterface();
// Initialize the PacketFileLogger plugin (for the logs)
PacketFileLogger* msgFileHandler = NULL;
if (cfg->logFile) {
msgFileHandler = new PacketFileLogger();
rakServer->AttachPlugin(msgFileHandler);
}
// Initialize security IF user has enabled it in config.ini
InitSecurity(rakServer, cfg->useEncryption);
// Initialize the SocketDescriptor
SocketDescriptor socketDescriptor(cfg->listenPort, 0);
// If the startup of the server is successful, print it to the console
// Otherwise, quit the server (as the char server is REQUIRED for the
// server to function properly)
if (rakServer->Startup(8, 30, &socketDescriptor, 1)) {
stringstream s;
s << "Characters started! Listening on: " << cfg->listenPort << "\n";
OutputQueue->Insert(s.str());
} else exit(2);
// Set max incoming connections to 8
rakServer->SetMaximumIncomingConnections(8);
// If msgFileHandler is not NULL, save logs of char server
if (msgFileHandler != NULL) msgFileHandler->StartLog(".\\logs\\char");
// Initialize the Packet class for the packets
Packet* packet;
// This will be used in the saving of packets below...
int i = 0;
while (!LUNIterminate) {
RakSleep(30); // This sleep keeps RakNet responsive
packet = rakServer->Receive(); // Recieve the packets from the server
if (packet == NULL) continue; // If packet is NULL, just continue without processing anything
PrintPacketInfo(packet, msgFileHandler); // Save packet info
// This will save all packets recieved from the client if running from DEBUG
#ifdef DEBUG
stringstream packetName;
packetName << ".//Saves//Packet" << i << ".bin";
SavePacket(packetName.str(), (char *)packet->data, packet->length);
i++;
#endif
switch (packet->data[0]) {
case ID_LEGO_PACKET:
switch (packet->data[1]) {
case GENERAL:
if (packet->data[3] == VERSION_CONFIRM) { // thats just a formality so far since no other numbers occured for this case
SendInitPacket(rakServer, packet->systemAddress, false);
}
break;
case SERVER:
switch (packet->data[3]) {
case CLIENT_VALIDATION:
{
cout << "Recieved client validation..." << endl;
break;
}
case CLIENT_CHARACTER_LIST_REQUEST:
{
auto usr = OnlineUsers->Find(packet->systemAddress);
if (usr->nameInUse == 0) {
cout << "Sending char packet...";
SendCharPacket(rakServer, packet->systemAddress, usr);
}
break;
}
case CLIENT_CHARACTER_CREATE_REQUEST:
{
// Find online user by systemAddress
auto usr = OnlineUsers->Find(packet->systemAddress);
// Make SURE user is not null!!!!!!
if (usr != NULL) {
AddCharToDatabase(rakServer, packet->systemAddress, packet->data, packet->length, usr);
}
else {
cout << "ERROR SAVING USER: User is null." << endl;
}
// If the username is in use, do NOT send the char packet. Otherwise, send it
if (usr->nameInUse == 0) {
SendCharPacket(rakServer, packet->systemAddress, usr);
}
}
//.........这里部分代码省略.........
示例7: WorldLoop
void WorldLoop(CONNECT_INFO* cfg, Ref< UsersPool > OnlineUsers, Ref< CrossThreadQueue< string > > OutputQueue) {
// Initialize the RakPeerInterface used throughout the entire server
RakPeerInterface* rakServer = RakNetworkFactory::GetRakPeerInterface();
// Initialize the PacketFileLogger plugin (for the logs)
PacketFileLogger* msgFileHandler = NULL;
if (cfg->logFile) {
msgFileHandler = new PacketFileLogger();
rakServer->AttachPlugin(msgFileHandler);
}
// Initialize security IF user has enabled it in config.ini
InitSecurity(rakServer, cfg->useEncryption);
// Initialize the SocketDescriptor
SocketDescriptor socketDescriptor(cfg->listenPort, 0);
// If the startup of the server is successful, print it to the console
// Otherwise, quit the server (as the char server is REQUIRED for the
// server to function properly)
if (rakServer->Startup(8, 30, &socketDescriptor, 1)) {
stringstream s;
s << "world started! Listening on: " << cfg->listenPort << "\n";
OutputQueue->Insert(s.str());
} else exit(2);
// Set max incoming connections to 8
rakServer->SetMaximumIncomingConnections(8);
// If msgFileHandler is not NULL, save logs of char server
if (msgFileHandler != NULL) msgFileHandler->StartLog(".\\logs\\world");
// Initialize the Packet class for the packets
Packet* packet;
// This will be used in the saving of packets below
int i = 0;
// This will be used in the saving of packets below...
while (!LUNIterminate) {
RakSleep(30); // This sleep keeps RakNet responsive
packet = rakServer->Receive(); // Recieve the packets from the server
if (packet == NULL) continue; // If packet is NULL, just continue without processing anything
// This will save all packets recieved from the client if running from DEBUG
#ifdef DEBUG
stringstream packetName;
packetName << ".//Saves//World_Packet" << i << ".bin";
SavePacket(packetName.str(), (char*)packet->data, packet->length);
i++;
#endif
// Create and send packets back here according to the one we got
switch (packet->data[0]) {
case ID_USER_PACKET_ENUM:
switch (packet->data[1]) {
case GENERAL:
if (packet->data[3] == 0) { // thats just a formality so far since no other numbers occured for this case
auto v = OpenPacket(".\\world\\init_aw.bin");
ServerSendPacket(rakServer, v, packet->systemAddress);
}
break;
case SERVER:
switch (packet->data[3]) {
case CLIENT_VALIDATION:
{
auto usr = OnlineUsers->Find(packet->systemAddress);
//this packets contains ZoneId and something else... but what?
// it starts whit: 53 05 00 02 00 00 00 00 -- -- (<-ZoneId) ?? ?? ??
vector< uchar > v;
if (usr != NULL && usr->nextcid == 2444680020) { //monkeybrown
v = OpenPacket(".\\world\\monkeybrown\\char_aw2.bin");
}
else if (usr != NULL && usr->nextcid == 1534792735) { //gruntmonkey
v = OpenPacket(".\\world\\gruntmonkey\\char_aw2.bin");
}
else if (usr != NULL && usr->nextcid == 1457240027) { //shafantastic
v = OpenPacket(".\\world\\shastafantastic\\char_aw22.bin");
}
else { //cheekymonkey
v = OpenPacket(".\\world\\char_aw2.bin");
}
#ifdef DEBUG
if (v.size() > 0) {
RakNet::BitStream bs( CleanPacket(v.data(), v.size()), v.size()-8, false );
ZoneId zid;
bs.Read(zid);
stringstream s;
s << "\nLoading world: " << zid << endl;
OutputQueue->Insert(s.str());
} else OutputQueue->Insert("\nWorld Error: can't load char_aw2.bin\n");
#endif
ServerSendPacket(rakServer, v, packet->systemAddress);
}
break;
//.........这里部分代码省略.........
示例8: AuthLoop
void AuthLoop(CONNECT_INFO* cfg, Ref< UsersPool > OnlineUsers, Ref< CrossThreadQueue< string > > OutputQueue) {
RakPeerInterface* rakServer = RakNetworkFactory::GetRakPeerInterface();
PacketFileLogger* msgFileHandler = NULL;
if (cfg->logFile) {
msgFileHandler = new PacketFileLogger();
rakServer->AttachPlugin(msgFileHandler);
}
InitSecurity(rakServer, cfg->useEncryption);
SocketDescriptor socketDescriptor(cfg->listenPort, 0);
if (rakServer->Startup(8, 30, &socketDescriptor, 1)) {
stringstream s;
s << "auth started! Listening on: " << cfg->listenPort << "\n";
OutputQueue->Insert(s.str());
} else QuitError("auth server init error!");
rakServer->SetMaximumIncomingConnections(8);
if (msgFileHandler != NULL) msgFileHandler->StartLog(".\\logs\\auth");
Packet* packet;
while (!LUNIterminate) {
RakSleep(30); // This sleep keeps RakNet responsive
packet = rakServer->Receive();
if (packet == NULL) continue;
PrintPacketInfo(packet, msgFileHandler);
switch (packet->data[0]) {
case ID_LEGO_PACKET:
switch (packet->data[1]) {
case LUNI_INITAW:
if (packet->data[3] == 0) { // thats just a formality so far since no other numbers occured for this case
// response: 00, 00
auto v = OpenPacket(".\\auth\\init_aw.bin");
// bytes 8-10 is the game version (same numbers are mentioned in the game log)
// the client expects it to be the same that he sent (otherwise he displays "server is being updated" and disconnects)
ServerSendPacket(rakServer, v, packet->systemAddress);
}
break;
case LUNI_LOGIN: //user logging into server
{
auto usr = HandleUserLogin(rakServer, packet, cfg, OnlineUsers);
if( usr != NULL ) OutputQueue->Insert("\n" + usr->GetUsername() + " Logged-in\n");
#ifdef DEBUG
else OutputQueue->Insert("\n Login failed!\n");
#endif
}
break;
default:
stringstream s;
s << "\nauth received unknow pakcet: " << RawDataToString(packet->data, packet->length) << endl;
OutputQueue->Insert(s.str());
}
break;
case ID_NEW_INCOMING_CONNECTION:
# ifdef DEBUG
OutputQueue->Insert("\n Auth is receiving a new connection...\n");
#endif
break;
case ID_DISCONNECTION_NOTIFICATION: // do nothing
break;
default:
stringstream s;
s << "\nauth received unknow pakcet: " << RawDataToString(packet->data, packet->length) << endl;
OutputQueue->Insert(s.str());
}
rakServer->DeallocatePacket(packet);
}
stringstream s;
s << "Quitting auth\n";
OutputQueue->Insert(s.str());
rakServer->Shutdown(0);
RakNetworkFactory::DestroyRakPeerInterface(rakServer);
}