mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-26 11:27:17 +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:
committed by
Arthur Dene Ice
parent
b2c9ba5bff
commit
5da3301570
@@ -64,7 +64,11 @@ EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout)
|
|||||||
void EQStreamFactory::Close()
|
void EQStreamFactory::Close()
|
||||||
{
|
{
|
||||||
Stop();
|
Stop();
|
||||||
|
CloseWithoutStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EQStreamFactory::CloseWithoutStop()
|
||||||
|
{
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
#else
|
#else
|
||||||
@@ -93,8 +97,7 @@ struct sockaddr_in address;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bind(sock, (struct sockaddr *) &address, sizeof(address)) < 0) {
|
if (bind(sock, (struct sockaddr *) &address, sizeof(address)) < 0) {
|
||||||
close(sock);
|
CloseWithoutStop();
|
||||||
sock=-1;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class EQStreamFactory : private Timeoutable {
|
|||||||
Timer *DecayTimer;
|
Timer *DecayTimer;
|
||||||
|
|
||||||
uint32 stream_timeout;
|
uint32 stream_timeout;
|
||||||
|
void CloseWithoutStop();
|
||||||
public:
|
public:
|
||||||
EQStreamFactory(EQStreamType type, uint32 timeout = 135000) : Timeoutable(5000), stream_timeout(timeout) { ReaderRunning=false; WriterRunning=false; StreamType=type; sock=-1; }
|
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);
|
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 Open(unsigned long port) { Port=port; return Open(); }
|
||||||
bool IsOpen() { return sock!=-1; }
|
bool IsOpen() { return sock!=-1; }
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
void ReaderLoop();
|
void ReaderLoop();
|
||||||
void WriterLoop();
|
void WriterLoop();
|
||||||
void Stop() { StopReader(); StopWriter(); }
|
void Stop() { StopReader(); StopWriter(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user