diff options
author | Henri Herscher <henri@oreka.org> | 2007-01-29 22:28:14 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2007-01-29 22:28:14 +0000 |
commit | 8b91c9a6ba076d686b7a03b9083d8541cc3c4109 (patch) | |
tree | f6c9df949c47c7b7e72ba71f5b228cc798b96b45 /orkbasecxx | |
parent | 792d7268067f4d3b35227d862cf5ae793815340a (diff) |
Made sure the OrkHttpClient cannot loop forever on suspicion of lockup.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@396 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx')
-rw-r--r-- | orkbasecxx/OrkClient.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/orkbasecxx/OrkClient.cpp b/orkbasecxx/OrkClient.cpp index 3804365..8fe5634 100644 --- a/orkbasecxx/OrkClient.cpp +++ b/orkbasecxx/OrkClient.cpp @@ -28,7 +28,9 @@ bool OrkHttpClient::ExecuteUrl(CStdString& request, CStdString& response, CStdSt ACE_SOCK_Connector connector; ACE_SOCK_Stream peer; ACE_INET_Addr peer_addr; + if(timeout < 1){timeout = 1;} ACE_Time_Value aceTimeout (timeout); + time_t beginRequestTimestamp = time(NULL); char szTcpPort[10]; sprintf(szTcpPort, "%d", tcpPort); @@ -72,7 +74,7 @@ bool OrkHttpClient::ExecuteUrl(CStdString& request, CStdString& response, CStdSt CStdString header; bool gotHeader = false; - while ( (numReceived = peer.recv (buf, BUFSIZE, &aceTimeout)) > 0 ) + while ( ((numReceived = peer.recv (buf, BUFSIZE, &aceTimeout)) > 0) && ((time(NULL) - beginRequestTimestamp) <= timeout) ) { for(int i=0; i<numReceived; i++) { |