mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-06 21:22:22 +00:00
Use os agnostic Close instead of windows deprecated close.
use the defined Close function instead of the internal (and linux specific) Close command
This commit is contained in:
parent
b2c9ba5bff
commit
5da3301570
@ -64,13 +64,17 @@ EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout)
|
||||
void EQStreamFactory::Close()
|
||||
{
|
||||
Stop();
|
||||
CloseWithoutStop();
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS
|
||||
closesocket(sock);
|
||||
#else
|
||||
close(sock);
|
||||
#endif
|
||||
sock=-1;
|
||||
void EQStreamFactory::CloseWithoutStop()
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
closesocket(sock);
|
||||
#else
|
||||
close(sock);
|
||||
#endif
|
||||
sock=-1;
|
||||
}
|
||||
|
||||
bool EQStreamFactory::Open()
|
||||
@ -93,8 +97,7 @@ struct sockaddr_in address;
|
||||
}
|
||||
|
||||
if (bind(sock, (struct sockaddr *) &address, sizeof(address)) < 0) {
|
||||
close(sock);
|
||||
sock=-1;
|
||||
CloseWithoutStop();
|
||||
return false;
|
||||
}
|
||||
#ifdef _WINDOWS
|
||||
|
||||
@ -35,7 +35,7 @@ class EQStreamFactory : private Timeoutable {
|
||||
Timer *DecayTimer;
|
||||
|
||||
uint32 stream_timeout;
|
||||
|
||||
void CloseWithoutStop();
|
||||
public:
|
||||
EQStreamFactory(EQStreamType type, uint32 timeout = 135000) : Timeoutable(5000), stream_timeout(timeout) { ReaderRunning=false; WriterRunning=false; StreamType=type; sock=-1; }
|
||||
EQStreamFactory(EQStreamType type, int port, uint32 timeout = 135000);
|
||||
@ -47,6 +47,7 @@ class EQStreamFactory : private Timeoutable {
|
||||
bool Open(unsigned long port) { Port=port; return Open(); }
|
||||
bool IsOpen() { return sock!=-1; }
|
||||
void Close();
|
||||
|
||||
void ReaderLoop();
|
||||
void WriterLoop();
|
||||
void Stop() { StopReader(); StopWriter(); }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user