change __WIN32 to WIN32 (oops)

This commit is contained in:
Lion Kortlepel
2020-11-03 12:01:31 +01:00
parent e9432ac1ca
commit e986df0579
14 changed files with 53 additions and 50 deletions

View File

@@ -21,15 +21,15 @@ void TCPSend(Client*c,const std::string&Data){
}
void TCPHandle(Client*c,const std::string& data){
Assert(c);
#ifdef __WIN32
#ifdef WIN32
__try{
#endif // __WIN32
#endif // WIN32
c->Handler.Handle(c,data);
#ifdef __WIN32
#ifdef WIN32
}__except(1){
c->Handler.clear();
}
#endif // __WIN32
#endif // WIN32
}
void TCPRcv(Client*c){
Assert(c);
@@ -43,11 +43,11 @@ void TCPRcv(Client*c){
if(c->GetStatus() > -1)c->SetStatus(-1);
return;
}else if (BytesRcv < 0) {
#ifdef __WIN32
#ifdef WIN32
debug(Sec("(TCP) recv failed with error: ") + std::to_string(WSAGetLastError()));
#else // unix
debug(Sec("(TCP) recv failed with error: ") + std::string(strerror(errno)));
#endif // __WIN32
#endif // WIN32
if(c->GetStatus() > -1)c->SetStatus(-1);
closesocket(c->GetTCPSock());
return;
@@ -64,13 +64,13 @@ void TCPClient(Client*c){
}
OnConnect(c);
while (c->GetStatus() > -1)TCPRcv(c);
#ifdef __WIN32
#ifdef WIN32
__try{
#endif // __WIN32
#endif // WIN32
OnDisconnect(c, c->GetStatus() == -2);
#ifdef __WIN32
#ifdef WIN32
}__except(Handle(GetExceptionInformation(),Sec("OnDisconnect"))){}
#endif // __WIN32
#endif // WIN32
}
void InitClient(Client*c){
std::thread NewClient(TCPClient,c);