netbase: extend CreateSock() to support creating arbitrary sockets

Allow the callers of `CreateSock()` to pass all 3 arguments to the
`socket(2)` syscall. This makes it possible to create sockets of
any domain/type/protocol.
This commit is contained in:
Vasil Dimov
2024-05-30 13:38:26 +02:00
parent 0b94fb8720
commit 1245d1388b
6 changed files with 33 additions and 33 deletions

View File

@@ -3029,7 +3029,7 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
return false;
}
std::unique_ptr<Sock> sock = CreateSock(addrBind.GetSAFamily());
std::unique_ptr<Sock> sock = CreateSock(addrBind.GetSAFamily(), SOCK_STREAM, IPPROTO_TCP);
if (!sock) {
strError = strprintf(Untranslated("Couldn't open socket for incoming connections (socket returned error %s)"), NetworkErrorString(WSAGetLastError()));
LogPrintLevel(BCLog::NET, BCLog::Level::Error, "%s\n", strError.original);