Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » [BUG - solved?] HttpRequest fails under FreeBSD
Re: [BUG] HttpRequest fails under FreeBSD [message #38893 is a reply to message #38885] |
Fri, 25 January 2013 22:20 |
Mindtraveller
Messages: 917 Registered: August 2007 Location: Russia, Moscow rgn.
|
Experienced Contributor |
|
|
Timeout check added.
Index: Socket.cpp
===================================================================
--- Socket.cpp (revision 5727)
+++ Socket.cpp (working copy)
@@ -268,7 +268,7 @@
sslinfo.Clear();
start_time = Null;
global_timeout = Null;
-#ifdef PLATFORM_WIN32
+#if (PLATFORM_WIN32 || PLATFORM_BSD)
connection_start = Null;
#endif
ssl_start = Null;
@@ -293,6 +293,9 @@
return false;
}
#else
+ #if (PLATFORM_BSD)
+ connection_start = msecs();
+ #endif
if(fcntl(socket, F_SETFL, (fcntl(socket, F_GETFL, 0) | O_NONBLOCK))) {
SetSockError("fcntl(O_[NON]BLOCK)");
return false;
@@ -509,7 +512,12 @@
{
int c = GetErrorCode();
#ifdef PLATFORM_POSIX
- return c == SOCKERR(EWOULDBLOCK) || c == SOCKERR(EAGAIN);
+ #ifdef PLATFORM_BSD
+ DUMP(connection_start);
+ if(c == SOCKERR(ENOTCONN) && !IsNull(connection_start) && msecs(connection_start) < 20000)
+ return true;
+ #endif
+ return c == c == SOCKERR(EWOULDBLOCK) || c == SOCKERR(EAGAIN);
#endif
#ifdef PLATFORM_WIN32
if(c == SOCKERR(ENOTCONN) && !IsNull(connection_start) && msecs(connection_start) < 20000) {
@@ -599,7 +607,7 @@
return false;
}
if(avail > 0) {
- #ifdef PLATFORM_WIN32
+ #if (PLATFORM_WIN32 || PLATFORM_BSD)
connection_start = Null;
#endif
return true;
@@ -630,7 +638,7 @@
{ // Compute time limit for operation, based on global timeout and per-operation timeout settings
int o = min(IsNull(global_timeout) ? INT_MAX : start_time + global_timeout,
IsNull(timeout) ? INT_MAX : msecs() + timeout);
-#ifdef PLATFORM_WIN32
+#if (PLATFORM_WIN32 || PLATFORM_BSD)
if(GetErrorCode() == SOCKERR(ENOTCONN) && !IsNull(connection_start))
if(msecs(connection_start) < 20000)
o = connection_start + 20000;
Index: Inet.h
===================================================================
--- Inet.h (revision 5727)
+++ Inet.h (working copy)
@@ -88,7 +88,7 @@
int global_timeout;
int start_time;
-#ifdef PLATFORM_WIN32
+#if (PLATFORM_WIN32 || PLATFORM_BSD)
int connection_start;
#endif
int ssl_start;
[Updated on: Fri, 25 January 2013 22:22] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed Apr 24 05:55:14 CEST 2024
Total time taken to generate the page: 0.01285 seconds
|