summaryrefslogtreecommitdiff
path: root/games/daimonin/files/patch-src-socket.c
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2010-09-27 09:02:17 +0000
committerPav Lucistnik <pav@FreeBSD.org>2010-09-27 09:02:17 +0000
commit329d477c09375f5b2a1963c6e5eed6615f43be09 (patch)
tree12fc7912e2ed9923cefb0cca3b0d6416f45c350b /games/daimonin/files/patch-src-socket.c
parentRemove bsd.cenkes.org from MASTER_SITE_CENKES due to: (diff)
- Update daimonin to 0.10.5
- Split music download to separate port - Give maintainership to submitter Submitted by: J. R. Olroyd <jr@opal.com>
Diffstat (limited to 'games/daimonin/files/patch-src-socket.c')
-rw-r--r--games/daimonin/files/patch-src-socket.c75
1 files changed, 72 insertions, 3 deletions
diff --git a/games/daimonin/files/patch-src-socket.c b/games/daimonin/files/patch-src-socket.c
index b3b066e35bd2..14369d4ee21e 100644
--- a/games/daimonin/files/patch-src-socket.c
+++ b/games/daimonin/files/patch-src-socket.c
@@ -1,6 +1,19 @@
---- ../../src/socket.c.orig 2008-05-10 13:14:59.000000000 +0300
-+++ ../../src/socket.c 2008-05-10 13:15:04.000000000 +0300
-@@ -706,7 +706,9 @@
+--- ../../src/socket.c.orig 2010-08-22 16:53:22.000000000 -0400
++++ ../../src/socket.c 2010-09-20 15:04:30.000000000 -0400
+@@ -728,6 +728,7 @@
+ memcpy(&insock.sin_addr, hostbn->h_addr, hostbn->h_length);
+ }
+
++#if 0
+ // Set non-blocking.
+ flags = fcntl(*socket_temp, F_GETFL);
+ if (fcntl(*socket_temp, F_SETFL, flags | O_NONBLOCK) == -1)
+@@ -736,11 +737,14 @@
+ *socket_temp = SOCKET_NO;
+ return(FALSE);
+ }
++#endif
+ // Try to connect.
start_timer = SDL_GetTicks();
while (connect(*socket_temp, (struct sockaddr *) &insock, sizeof(insock)) == -1)
{
@@ -11,3 +24,59 @@
/* timeout.... without connect will REALLY hang a long time */
if (start_timer + SOCKET_TIMEOUT_MS < SDL_GetTicks())
{
+@@ -749,6 +753,7 @@
+ return(FALSE);
+ }
+ }
++#if 0
+ // Set back to blocking.
+ if (fcntl(*socket_temp, F_SETFL, flags) == -1)
+ {
+@@ -756,6 +761,7 @@
+ *socket_temp = SOCKET_NO;
+ return(FALSE);
+ }
++#endif
+ #else
+ struct addrinfo hints;
+ struct addrinfo *res = NULL, *ai;
+@@ -786,6 +792,7 @@
+ *socket_temp = SOCKET_NO;
+ continue;
+ }
++#if 0
+ // Set non-blocking.
+ flags = fcntl(*socket_temp, F_GETFL);
+ if (fcntl(*socket_temp, F_SETFL, flags | O_NONBLOCK) == -1)
+@@ -794,11 +801,14 @@
+ *socket_temp = SOCKET_NO;
+ return(FALSE);
+ }
++#endif
+ // Try to connect.
+ start_timer = SDL_GetTicks();
+ while (connect(*socket_temp, ai->ai_addr, ai->ai_addrlen) != 0)
+ {
+- SDL_Delay(3);
++ // EINPROGRESS leads to EALREADY over few iterations
++ if (errno == EALREADY) break;
++ SDL_Delay(30);
+ /* timeout.... without connect will REALLY hang a long time */
+ if (start_timer + SOCKET_TIMEOUT_MS < SDL_GetTicks())
+ {
+@@ -807,6 +817,7 @@
+ goto next_try;
+ }
+ }
++#if 0
+ // Set back to blocking.
+ if (fcntl(*socket_temp, F_SETFL, flags) == -1)
+ {
+@@ -814,6 +825,7 @@
+ *socket_temp = SOCKET_NO;
+ return(FALSE);
+ }
++#endif
+ break;
+ next_try:
+ ;