mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-11-08 14:05:10 +01:00
Sleep for 5 seconds when creating a socket failed
This commit is contained in:
parent
de6f657c3d
commit
76ddeb32e3
@ -19,9 +19,10 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "socket.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "platform.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
@ -31,6 +32,8 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
Socket::~Socket ()
|
||||
{
|
||||
@ -100,6 +103,7 @@ bool Socket::bind (SockAddr const &addr_)
|
||||
case AF_INET:
|
||||
if (::bind (m_fd, addr_, sizeof (struct sockaddr_in)) != 0)
|
||||
{
|
||||
platform::Thread::sleep (5000ms);
|
||||
error ("bind: %s\n", std::strerror (errno));
|
||||
return false;
|
||||
}
|
||||
@ -110,6 +114,7 @@ bool Socket::bind (SockAddr const &addr_)
|
||||
if (::bind (m_fd, addr_, sizeof (struct sockaddr_in6)) != 0)
|
||||
{
|
||||
error ("bind: %s\n", std::strerror (errno));
|
||||
platform::Thread::sleep (5000ms);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user