Commit e0cabc89 authored by Suresh Namla's avatar Suresh Namla

Dlib::http_client - Changes for configured Socket Connection Initialization Timeout

parent 80ea9c66
...@@ -553,7 +553,7 @@ namespace dlib ...@@ -553,7 +553,7 @@ namespace dlib
dlib::connection * conn(0); dlib::connection * conn(0);
try try
{ {
conn = dlib::connect(host, port); conn = dlib::connect(host, port, connection_timeout);
} }
catch (const dlib::socket_error& e) catch (const dlib::socket_error& e)
{ {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
// Default timeout after 60 seconds // Default timeout after 60 seconds
#define DEFAULT_TIMEOUT 60000 #define DEFAULT_TIMEOUT 60000
#define DEFAULT_CONNECTION_TIMEOUT 21000
namespace dlib namespace dlib
{ {
...@@ -50,7 +51,7 @@ namespace dlib ...@@ -50,7 +51,7 @@ namespace dlib
void set_timeout( unsigned int milliseconds = DEFAULT_TIMEOUT ) { timeout = milliseconds; } void set_timeout( unsigned int milliseconds = DEFAULT_TIMEOUT ) { timeout = milliseconds; }
void set_connectiontimeout(unsigned int milliseconds = DEFAULT_CONNECTION_TIMEOUT) { connection_timeout = milliseconds; }
string_to_stringvector get_returned_headers() const { return returned_headers; } string_to_stringvector get_returned_headers() const { return returned_headers; }
short get_http_return () const { return http_return; } short get_http_return () const { return http_return; }
...@@ -86,6 +87,7 @@ namespace dlib ...@@ -86,6 +87,7 @@ namespace dlib
std::string returned_body, error_field; std::string returned_body, error_field;
unsigned int timeout; unsigned int timeout;
unsigned int connection_timeout;
fnOnDownload OnDownload; fnOnDownload OnDownload;
void * user_info; void * user_info;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment