~ubuntu-branches/ubuntu/raring/dovecot/raring

« back to all changes in this revision

Viewing changes to src/lib-sql/driver-mysql.c

  • Committer: Package Import Robot
  • Author(s): Marco Nenciarini
  • Date: 2011-09-19 19:26:48 UTC
  • mfrom: (1.14.4 upstream)
  • mto: (4.8.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 86.
  • Revision ID: package-import@ubuntu.com-20110919192648-ri3sovtiz334yori
Tags: 1:2.0.15-1
* [a22575a] New upstream version 2.0.15: (Closes: #642045)
    + doveadm altmove: Added -r parameter to move mails back to primary
      storage.
    - v2.0.14: Index reading could have eaten a lot of memory in some
      situations
    - doveadm index no longer affects future caching decisions
    - mbox: Fixed crash during mail delivery when mailbox didn't yet have
      GUID assigned to it.
    - zlib+mbox: Fetching last message from compressed mailboxes crashed.
    - lib-sql: Fixed load balancing and error
* [8ce5abc] Update pigeonhole to release 0.2.4
* [87658d2] Add dovecot-solr to dovecot-core's Suggests line.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Copyright (c) 2003-2011 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
 
4
#include "ioloop.h"
4
5
#include "array.h"
5
6
#include "str.h"
6
7
#include "sql-api-private.h"
62
63
        struct mysql_db *db = (struct mysql_db *)_db;
63
64
        const char *unix_socket, *host;
64
65
        unsigned long client_flags = db->client_flags;
 
66
        unsigned int secs_used;
65
67
        bool failed;
66
68
 
67
69
        i_assert(db->api.state == SQL_DB_STATE_DISCONNECTED);
107
109
        failed = mysql_real_connect(db->mysql, host, db->user, db->password,
108
110
                                    db->dbname, db->port, unix_socket,
109
111
                                    client_flags) == NULL;
110
 
        alarm(0);
 
112
        secs_used = SQL_CONNECT_TIMEOUT_SECS - alarm(0);
111
113
        if (failed) {
 
114
                /* connecting could have taken a while. make sure that any
 
115
                   timeouts that get added soon will get a refreshed
 
116
                   timestamp. */
 
117
                io_loop_time_refresh();
 
118
 
 
119
                if (db->api.connect_delay < secs_used)
 
120
                        db->api.connect_delay = secs_used;
112
121
                sql_db_set_state(&db->api, SQL_DB_STATE_DISCONNECTED);
113
122
                i_error("%s: Connect failed to database (%s): %s - "
114
123
                        "waiting for %u seconds before retry",