WebDAV: use RetryDuration property as timeout interval
The RetryDuration value now defines the time after which the Neon library is told to give up. Previously some Neon-internal default was used. Resending a pending request earlier still needs to be implemented. As with SyncML over HTTP, a loss of network connectivity can lead to a half-open TCP connection which the client cannot detect when relying on TCP alone.
This commit is contained in:
parent
9c1dda1084
commit
f9bdf5123d
|
@ -201,6 +201,13 @@ Session::Session(const boost::shared_ptr<Settings> &settings) :
|
|||
URI proxyuri = URI::parse(m_proxyURL);
|
||||
ne_session_proxy(m_session, proxyuri.m_host.c_str(), proxyuri.m_port);
|
||||
}
|
||||
|
||||
int seconds = settings->timeoutSeconds();
|
||||
if (seconds < 0) {
|
||||
seconds = 5 * 60;
|
||||
}
|
||||
ne_set_read_timeout(m_session, seconds);
|
||||
ne_set_connect_timeout(m_session, seconds);
|
||||
}
|
||||
|
||||
Session::~Session()
|
||||
|
|
|
@ -90,6 +90,12 @@ class Settings {
|
|||
*/
|
||||
virtual bool googleAlarmHack() const = 0;
|
||||
|
||||
/**
|
||||
* duration in seconds after which communication with a server
|
||||
* fails with a timeout error; <= 0 picks a large default value
|
||||
*/
|
||||
virtual int timeoutSeconds() const = 0;
|
||||
|
||||
/**
|
||||
* use this to create a boost_shared pointer for a
|
||||
* Settings instance which needs to be freed differently
|
||||
|
|
|
@ -109,6 +109,12 @@ public:
|
|||
virtual bool googleChildHack() const { return m_googleChildHack; }
|
||||
virtual bool googleAlarmHack() const { return m_googleChildHack; }
|
||||
|
||||
/**
|
||||
* Communication is aborted after the configured retry duration.
|
||||
* TODO: resend after retryInterval() seconds.
|
||||
*/
|
||||
virtual int timeoutSeconds() const { return m_context->getRetryDuration(); }
|
||||
|
||||
virtual void getCredentials(const std::string &realm,
|
||||
std::string &username,
|
||||
std::string &password)
|
||||
|
|
Loading…
Reference in New Issue