mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Web: Per-socket error handling
git-svn-id: svn://ultimatepp.org/upp/trunk@3229 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
1d22be6416
commit
2ac4fc2dc3
2 changed files with 12 additions and 4 deletions
|
|
@ -408,7 +408,9 @@ bool Socket::Data::Peek(int timeout_msec, bool write)
|
|||
void Socket::Data::SetSockError(String context)
|
||||
{
|
||||
SetError();
|
||||
Socket::SetSockError(socket, context);
|
||||
errorcode = Socket::GetErrorCode();
|
||||
errordesc = SocketErrorDesc(Socket::GetErrorCode());
|
||||
Socket::SetSockError(socket, context, errordesc);
|
||||
}
|
||||
|
||||
void Socket::Data::NoDelay()
|
||||
|
|
|
|||
|
|
@ -22,8 +22,10 @@ public:
|
|||
bool IsEof() const { return is_eof && leftover.IsEmpty(); }
|
||||
bool IsError() const { return is_error; }
|
||||
void SetError() { is_error = true; }
|
||||
void ClearError() { is_error = false; }
|
||||
void ClearError() { is_error = false; errorcode = 0; errordesc.Clear(); }
|
||||
void SetSockError(String context);
|
||||
int GetError() const { return errorcode; }
|
||||
String GetErrorDesc() const { return errordesc; }
|
||||
|
||||
void NoDelay();
|
||||
void Linger(int msecs);
|
||||
|
|
@ -49,6 +51,8 @@ public:
|
|||
bool is_blocking;
|
||||
bool is_error;
|
||||
bool is_eof;
|
||||
int errorcode;
|
||||
String errordesc;
|
||||
#ifndef NOFAKEERROR
|
||||
int fake_error;
|
||||
#endif
|
||||
|
|
@ -73,8 +77,10 @@ public:
|
|||
bool IsOpen() const { return data && data->IsOpen(); }
|
||||
|
||||
bool IsEof() const { return !data || data->IsEof(); }
|
||||
bool IsError() const { return data->IsError(); }
|
||||
void ClearError() { data->ClearError(); }
|
||||
bool IsError() const { return !data || data->IsError(); }
|
||||
void ClearError() { if(data) data->ClearError(); }
|
||||
int GetError() const { return data ? data->GetError() : 0; }
|
||||
String GetErrorDesc() const { return data ? data->GetErrorDesc() : String(); }
|
||||
|
||||
SOCKET GetSocket() const { return IsOpen() ? data->socket : INVALID_SOCKET; }
|
||||
int GetNumber() const { return (int)GetSocket(); }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue