Minor Fixes

This commit is contained in:
Anonymous275 2020-05-04 16:15:49 +03:00
parent 93299f0fa4
commit cc537802f7
4 changed files with 205 additions and 200 deletions

View File

@ -7,7 +7,8 @@
#include <string>
#include <thread>
#define DEFAULT_BUFLEN 64000
#define DEFAULT_PORT "4444"
extern int DEFAULT_PORT;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
@ -88,7 +89,7 @@ std::string Parse(const std::string& Data){
hints.ai_flags = AI_PASSIVE;
// Resolve the server address and port
iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result);
iResult = getaddrinfo(nullptr, std::to_string(DEFAULT_PORT).c_str(), &hints, &result);
if ( iResult != 0 ) {
if(MPDEV)std::cout << "(Core) getaddrinfo failed with error: " << iResult << std::endl;
WSACleanup();

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ std::vector<std::string> GetDiscordInfo();
std::vector<std::string> GlobalInfo;
std::vector<std::string> Check();
std::string getHardwareID();
extern int DEFAULT_PORT;
int DEFAULT_PORT = 4444;
void Discord_Main();
bool MPDEV = false;
void ProxyStart();

View File

@ -12,7 +12,7 @@
#include <thread>
#include <queue>
int DEFAULT_PORT = 4445;
extern int DEFAULT_PORT;
typedef struct {
ENetHost *host;
ENetPeer *peer;
@ -26,8 +26,8 @@ bool Terminate = false;
bool CServer = true;
ENetPeer*ServerPeer;
SOCKET*ClientSocket;
int ping = 0;
extern bool MPDEV;
int ping = 0;
[[noreturn]] void CoreNetworkThread();
@ -38,11 +38,10 @@ void TCPSEND(const std::string&Data){
if (MPDEV)std::cout << "(Proxy) send failed with error: " << WSAGetLastError() << std::endl;
TCPTerminate = true;
} else {
if (MPDEV && iSendResult > 1000) {
std::cout << "(Launcher->Game) Bytes sent: " << iSendResult << " : " << Data.substr(0, 10)
<< Data.substr(Data.length() - 10) << std::endl;
if (MPDEV && Data.length() > 1000) {
std::cout << "(Launcher->Game) Bytes sent: " << iSendResult << " : " << Data << std::endl;
}
//std::cout << "(Launcher->Game) Bytes sent: " << iSendResult << " : " << RUDPData.front()<< std::endl;
//std::cout << "(Launcher->Game) Bytes sent: " << iSendResult << " : " << Data << std::endl;
}
}
}
@ -147,7 +146,7 @@ void RUDPClientThread(const std::string& IP, int Port){
HandleEvent(event,client);
}
enet_peer_disconnect(client.peer,0);
enet_host_service(client.host, &event, 0);
enet_host_service(client.host, &event, 1);
HandleEvent(event,client);
CServer = true;
std::cout << "Connection Terminated!" << std::endl;
@ -182,7 +181,7 @@ void TCPServerThread(const std::string& IP, int Port){
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = AI_PASSIVE;
// Resolve the server address and port
iResult = getaddrinfo(nullptr, std::to_string(DEFAULT_PORT).c_str(), &hints, &result);
iResult = getaddrinfo(nullptr, std::to_string(DEFAULT_PORT+1).c_str(), &hints, &result);
if (iResult != 0) {
if(MPDEV)std::cout << "(Proxy) getaddrinfo failed with error: " << iResult << std::endl;
WSACleanup();