mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Add small timeouts to blocking recv/send so we don't spin forever
This commit is contained in:
@@ -103,6 +103,9 @@ bool Socket::SendDataBlocking(const void *buf, uint32_t length)
|
||||
|
||||
u_long enable = 0;
|
||||
ioctlsocket(socket, FIONBIO, &enable);
|
||||
|
||||
DWORD timeout = 3000;
|
||||
setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, (const char *)&timeout, sizeof(timeout));
|
||||
|
||||
while(sent < length)
|
||||
{
|
||||
@@ -131,6 +134,9 @@ bool Socket::SendDataBlocking(const void *buf, uint32_t length)
|
||||
enable = 1;
|
||||
ioctlsocket(socket, FIONBIO, &enable);
|
||||
|
||||
timeout = 600000;
|
||||
setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, (const char *)&timeout, sizeof(timeout));
|
||||
|
||||
RDCASSERT(sent == length);
|
||||
|
||||
return true;
|
||||
@@ -175,6 +181,9 @@ bool Socket::RecvDataBlocking(void *buf, uint32_t length)
|
||||
|
||||
u_long enable = 0;
|
||||
ioctlsocket(socket, FIONBIO, &enable);
|
||||
|
||||
DWORD timeout = 3000;
|
||||
setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, (const char *)&timeout, sizeof(timeout));
|
||||
|
||||
while(received < length)
|
||||
{
|
||||
@@ -207,6 +216,9 @@ bool Socket::RecvDataBlocking(void *buf, uint32_t length)
|
||||
|
||||
enable = 1;
|
||||
ioctlsocket(socket, FIONBIO, &enable);
|
||||
|
||||
timeout = 600000;
|
||||
setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, (const char *)&timeout, sizeof(timeout));
|
||||
|
||||
RDCASSERT(received == length);
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace renderdoc
|
||||
|
||||
if (rendPtr == IntPtr.Zero)
|
||||
{
|
||||
var e = new System.ApplicationException("Failed to load log for local replay");
|
||||
var e = new System.ApplicationException("Failed to open remote access connection");
|
||||
e.Data.Add("status", ReplayCreateStatus.UnknownError);
|
||||
throw e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user