mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
Set sockets to be specifically non-inheritable
* This means if a process with a remote connection creates a child process we don't have the socket stay open zombie-like.
This commit is contained in:
@@ -28,6 +28,10 @@
|
||||
|
||||
#include "os/os_specific.h"
|
||||
|
||||
#ifndef WSA_FLAG_NO_HANDLE_INHERIT
|
||||
#define WSA_FLAG_NO_HANDLE_INHERIT 0x80
|
||||
#endif
|
||||
|
||||
namespace Network
|
||||
{
|
||||
|
||||
@@ -227,7 +231,7 @@ bool Socket::RecvDataBlocking(void *buf, uint32_t length)
|
||||
|
||||
Socket *CreateServerSocket(const char *bindaddr, uint16_t port, int queuesize)
|
||||
{
|
||||
SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
SOCKET s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_NO_HANDLE_INHERIT);
|
||||
|
||||
if(s == INVALID_SOCKET)
|
||||
return NULL;
|
||||
@@ -277,7 +281,7 @@ Socket *CreateClientSocket(const wchar_t *host, uint16_t port, int timeoutMS)
|
||||
|
||||
for(addrinfoW *ptr = result; ptr != NULL; ptr = ptr->ai_next)
|
||||
{
|
||||
SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
SOCKET s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_NO_HANDLE_INHERIT);
|
||||
|
||||
if(s == INVALID_SOCKET)
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user