~noskcaj/ubuntu/utopic/geary/merge2

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2013-11-12 23:33:28 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20131112233328-vdn6jgkv2sketj3z
Tags: 0.4.1-0ubuntu1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
481
481
     * call, depending on the results of the connection greeting from the server.  However,
482
482
     * command should only be transmitted (login, initiate session, etc.) after this call has
483
483
     * completed.
 
484
     *
 
485
     * If the connection fails (if this call throws an Error) the ClientSession will be disconnected,
 
486
     * even if the error was from the server (that is, not a network problem).  The
 
487
     * {@link ClientSession} should be discarded.
484
488
     */
485
489
    public async void connect_async(Cancellable? cancellable = null) throws Error {
486
490
        MachineParams params = new MachineParams(null);
514
518
        // cancel the timeout, if it's not already fired
515
519
        timeout.cancel();
516
520
        
517
 
        // if session was denied or timeout, throw the Error
518
 
        if (connect_err != null)
 
521
        // if session was denied or timeout, ensure the session is disconnected and throw the
 
522
        // original Error ... connect_async shouldn't leave the session in a LOGGED_OUT state,
 
523
        // but completely disconnected if unsuccessful
 
524
        if (connect_err != null) {
 
525
            try {
 
526
                yield disconnect_async(cancellable);
 
527
            } catch (Error err) {
 
528
                debug("[%s] Error disconnecting after a failed connect attempt: %s", to_string(),
 
529
                    err.message);
 
530
            }
 
531
            
519
532
            throw connect_err;
 
533
        }
520
534
    }
521
535
    
522
536
    private bool on_greeting_timeout() {