add GetError()

on WSAECONNRESET, just return 0, not error
set STATE_SHUTDOWN on shutdown, though nothing uses this right now;
maybe this should be removed, and instead say "always call Close()
at the end of successful processing in the thread" (to ensure that we don't
block later)
This commit is contained in:
Glenn Maynard
2006-02-14 01:52:42 +00:00
parent 70e66e9aa4
commit 9057367ef2
2 changed files with 11 additions and 0 deletions
@@ -479,6 +479,7 @@ void NetworkStream_Win32::Shutdown()
return;
shutdown( m_Socket, SD_BOTH );
m_State = STATE_SHUTDOWN;
}
void NetworkStream_Win32::Cancel()
@@ -540,6 +541,10 @@ int NetworkStream_Win32::Read( void *pBuffer, size_t iSize )
continue;
}
/* If the other side closed the connection, just return EOF. */
if( iError == WSAECONNRESET )
break;
/* If we're cancelled or hit an error while reading, do return the data we managed
* to get. Be sure not to overwrite CANCELLED with ERROR. */
SetError( ssprintf("Error reading: %s", WinSockErrorToString(iError).c_str() ) );
@@ -738,6 +743,11 @@ float NetworkPostData::GetProgress() const
return m_fProgress;
}
RString NetworkPostData::GetError() const
{
return m_pStream->GetError();
}
void NetworkPostData::SetProgress( float fProgress )
{
m_Mutex.Lock();
@@ -28,6 +28,7 @@ public:
RString GetStatus() const;
float GetProgress() const;
RString GetError() const;
RString GetResult() const { return m_sResult; }
private: