mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
net: add new method Sock::Bind() that wraps bind()
This will help to increase `Sock` usage and make more code mockable.
This commit is contained in:
parent
7164e00e1b
commit
3ad7de225e
6 changed files with 36 additions and 2 deletions
|
|
@ -2396,8 +2396,7 @@ bool CConnman::BindListenPort(const CService& addrBind, bilingual_str& strError,
|
|||
#endif
|
||||
}
|
||||
|
||||
if (::bind(sock->Get(), (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR)
|
||||
{
|
||||
if (sock->Bind(reinterpret_cast<struct sockaddr*>(&sockaddr), len) == SOCKET_ERROR) {
|
||||
int nErr = WSAGetLastError();
|
||||
if (nErr == WSAEADDRINUSE)
|
||||
strError = strprintf(_("Unable to bind to %s on this computer. %s is probably already running."), addrBind.ToString(), PACKAGE_NAME);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue