mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 18:55:07 +00:00
LibGUI: Add some extremely primitive retrying for the server connection.
This commit is contained in:
parent
ce74db4e2a
commit
c7f5213d5b
1 changed files with 11 additions and 3 deletions
|
@ -39,10 +39,18 @@ GEventLoop::GEventLoop()
|
||||||
sockaddr_un address;
|
sockaddr_un address;
|
||||||
address.sun_family = AF_LOCAL;
|
address.sun_family = AF_LOCAL;
|
||||||
strcpy(address.sun_path, "/wsportal");
|
strcpy(address.sun_path, "/wsportal");
|
||||||
int rc = connect(m_event_fd, (const sockaddr*)&address, sizeof(address));
|
|
||||||
if (rc < 0) {
|
int retries = 10;
|
||||||
|
int rc = 0;
|
||||||
|
while (retries) {
|
||||||
|
rc = connect(m_event_fd, (const sockaddr*)&address, sizeof(address));
|
||||||
|
if (rc == 0)
|
||||||
|
break;
|
||||||
dbgprintf("connect failed: %d, %s\n", errno, strerror(errno));
|
dbgprintf("connect failed: %d, %s\n", errno, strerror(errno));
|
||||||
perror("connect");
|
sleep(1);
|
||||||
|
--retries;
|
||||||
|
}
|
||||||
|
if (rc < 0) {
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue