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:
@@ -479,6 +479,7 @@ void NetworkStream_Win32::Shutdown()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
shutdown( m_Socket, SD_BOTH );
|
shutdown( m_Socket, SD_BOTH );
|
||||||
|
m_State = STATE_SHUTDOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkStream_Win32::Cancel()
|
void NetworkStream_Win32::Cancel()
|
||||||
@@ -540,6 +541,10 @@ int NetworkStream_Win32::Read( void *pBuffer, size_t iSize )
|
|||||||
continue;
|
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
|
/* 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. */
|
* to get. Be sure not to overwrite CANCELLED with ERROR. */
|
||||||
SetError( ssprintf("Error reading: %s", WinSockErrorToString(iError).c_str() ) );
|
SetError( ssprintf("Error reading: %s", WinSockErrorToString(iError).c_str() ) );
|
||||||
@@ -738,6 +743,11 @@ float NetworkPostData::GetProgress() const
|
|||||||
return m_fProgress;
|
return m_fProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RString NetworkPostData::GetError() const
|
||||||
|
{
|
||||||
|
return m_pStream->GetError();
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkPostData::SetProgress( float fProgress )
|
void NetworkPostData::SetProgress( float fProgress )
|
||||||
{
|
{
|
||||||
m_Mutex.Lock();
|
m_Mutex.Lock();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public:
|
|||||||
|
|
||||||
RString GetStatus() const;
|
RString GetStatus() const;
|
||||||
float GetProgress() const;
|
float GetProgress() const;
|
||||||
|
RString GetError() const;
|
||||||
RString GetResult() const { return m_sResult; }
|
RString GetResult() const { return m_sResult; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user