~ubuntu-branches/ubuntu/saucy/geary/saucy-updates

« back to all changes in this revision

Viewing changes to src/engine/imap/transport/imap-client-session-manager.vala

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2013-10-10 17:40:37 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20131010174037-5p5o4dlsoewek2kg
Tags: 0.4.0-0ubuntu1
New stable version

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
public class Geary.Imap.ClientSessionManager : BaseObject {
8
8
    public const int DEFAULT_MIN_POOL_SIZE = 2;
 
9
    private const int AUTHORIZED_SESSION_ERROR_RETRY_TIMEOUT_MSEC = 1000;
9
10
    
10
11
    public bool is_open { get; private set; default = false; }
11
12
    
49
50
    private Nonblocking.Mutex sessions_mutex = new Nonblocking.Mutex();
50
51
    private Gee.HashSet<ClientSession> reserved_sessions = new Gee.HashSet<ClientSession>();
51
52
    private bool authentication_failed = false;
 
53
    private uint authorized_session_error_retry_timeout_id = 0;
52
54
    
53
55
    public signal void login_failed();
54
56
    
159
161
            debug("Unable to create authorized session to %s: %s",
160
162
                account_information.get_imap_endpoint().to_string(), err.message);
161
163
            
162
 
            // try again
163
 
            adjust_session_pool.begin();
 
164
            // try again after a slight delay
 
165
            if (authorized_session_error_retry_timeout_id != 0)
 
166
                Source.remove(authorized_session_error_retry_timeout_id);
 
167
            authorized_session_error_retry_timeout_id
 
168
                = Timeout.add(AUTHORIZED_SESSION_ERROR_RETRY_TIMEOUT_MSEC,
 
169
                on_authorized_session_error_retry_timeout);
164
170
        }
165
171
    }
166
172
    
 
173
    private bool on_authorized_session_error_retry_timeout() {
 
174
        authorized_session_error_retry_timeout_id = 0;
 
175
        
 
176
        adjust_session_pool.begin();
 
177
        
 
178
        return false;
 
179
    }
 
180
    
167
181
    // The locked parameter indicates if this is called while the sessions_mutex is locked
168
182
    private async ClientSession create_new_authorized_session(bool locked, Cancellable? cancellable)
169
183
        throws Error {