Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added Timeout setting to CalDAVConnectionData/CalDAVStatus
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 1 Mar 2016 17:09:21 +0000 (17:09 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 1 Mar 2016 17:09:21 +0000 (17:09 +0000)
source/objects/CalDAV/CalDAV.cpp
source/objects/CalDAV/CalDAV.h
source/tests/xestiacalendar_caldav.h

index c781e94..964f286 100644 (file)
@@ -77,6 +77,7 @@ CalDAVStatus CalDAV::GetConnectionData(){
        ConnectionStatus.Username = ConnectionData.Username;
        ConnectionStatus.Prefix = ConnectionData.Prefix;
        ConnectionStatus.UseSSL = ConnectionData.UseSSL;
+       ConnectionStatus.Timeout = ConnectionData.Timeout;
        
        return ConnectionStatus;
        
@@ -121,6 +122,7 @@ CalDAVServerResult CalDAV::Connect(){
        curl_easy_setopt(ConnectionHandle, CURLOPT_USERPWD, ServerUserPass.c_str());
        curl_easy_setopt(ConnectionHandle, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
        curl_easy_setopt(ConnectionHandle, CURLOPT_FAILONERROR, 1L);
+       curl_easy_setopt(ConnectionHandle, CURLOPT_TIMEOUT, ConnectionData.Timeout);
        curl_easy_setopt(ConnectionHandle, CURLOPT_WRITEFUNCTION, CalDAVOutput);
        curl_easy_setopt(ConnectionHandle, CURLOPT_WRITEDATA, &ServerData);
        curl_easy_setopt(ConnectionHandle, CURLOPT_WRITEHEADER, &ServerHeader);
index cbae3d8..2ccd4ea 100644 (file)
@@ -43,6 +43,7 @@ struct CalDAVConnectionData{
        string Password = "";
        string Prefix = "";
        bool UseSSL = true;
+       int Timeout = 60;
        
 };
 
@@ -58,6 +59,7 @@ struct CalDAVStatus{
        string Username;
        string Prefix;
        bool UseSSL;    
+       int Timeout;
 
 };
 
index e2660fb..5fd20c6 100644 (file)
@@ -236,6 +236,8 @@ TEST(CalDAV, BasicTests){
        // (*nix version) Setup an inital connection on a server where
        // a timeout occurs.
        
+       ConnTimeout.Timeout = 5;
+       
        CalDAV CalDAVTimeout;
        CalDAVTimeout.SetupConnectionData(&ConnTimeout);
 
@@ -248,6 +250,7 @@ TEST(CalDAV, BasicTests){
        ASSERT_EQ(CalDAVTimeoutStatus.Username, ConnTimeout.Username);
        ASSERT_EQ(CalDAVTimeoutStatus.Port, ConnTimeout.Port);
        ASSERT_EQ(CalDAVTimeoutStatus.Prefix, ConnTimeout.Prefix);
+       ASSERT_EQ(CalDAVTimeoutStatus.Timeout, ConnTimeout.Timeout);
        ASSERT_EQ(CalDAVTimeoutStatus.UseSSL, ConnTimeout.UseSSL);
        
        // Verify that the connection had timed out.
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy