~ubuntu-branches/ubuntu/trusty/dovecot/trusty-updates

« back to all changes in this revision

Viewing changes to src/replication/aggregator/replicator-connection.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (1.15.3) (96.1.1 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20140108093549-814nkqdcxfbvgktg
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "ioloop.h"
5
 
#include "network.h"
 
5
#include "net.h"
6
6
#include "istream.h"
7
7
#include "ostream.h"
8
8
#include "buffer.h"
29
29
 
30
30
        buffer_t *queue[REPLICATION_PRIORITY_SYNC + 1];
31
31
 
32
 
        struct hash_table *requests;
 
32
        HASH_TABLE(void *, void *) requests;
33
33
        unsigned int request_id_counter;
34
34
        replicator_sync_callback_t *callback;
35
35
};
54
54
                i_error("Replicator sent invalid ID: %u", id);
55
55
                return -1;
56
56
        }
57
 
        hash_table_remove(conn->requests, context);
 
57
        hash_table_remove(conn->requests, POINTER_CAST(id));
58
58
        conn->callback(line[0] == '+', context);
59
59
        return 0;
60
60
}
172
172
        conn->io = io_add(fd, IO_READ, replicator_input, conn);
173
173
        conn->input = i_stream_create_fd(fd, MAX_INBUF_SIZE, FALSE);
174
174
        conn->output = o_stream_create_fd(fd, (size_t)-1, FALSE);
175
 
        (void)o_stream_send_str(conn->output, REPLICATOR_HANDSHAKE);
 
175
        o_stream_set_no_error_handling(conn->output, TRUE);
 
176
        o_stream_nsend_str(conn->output, REPLICATOR_HANDSHAKE);
176
177
        o_stream_set_flush_callback(conn->output, replicator_output, conn);
177
178
}
178
179
 
182
183
        void *key, *value;
183
184
 
184
185
        iter = hash_table_iterate_init(conn->requests);
185
 
        while (hash_table_iterate(iter, &key, &value))
 
186
        while (hash_table_iterate(iter, conn->requests, &key, &value))
186
187
                conn->callback(FALSE, value);
187
188
        hash_table_iterate_deinit(&iter);
188
189
        hash_table_clear(conn->requests, TRUE);
208
209
 
209
210
        conn = i_new(struct replicator_connection, 1);
210
211
        conn->fd = -1;
211
 
        conn->requests = hash_table_create(default_pool, default_pool,
212
 
                                           0, NULL, NULL);
 
212
        hash_table_create_direct(&conn->requests, default_pool, 0);
213
213
        for (i = REPLICATION_PRIORITY_LOW; i <= REPLICATION_PRIORITY_SYNC; i++)
214
214
                conn->queue[i] = buffer_create_dynamic(default_pool, 1024);
215
215
        return conn;
269
269
        if (conn->fd != -1 &&
270
270
            o_stream_get_buffer_used_size(conn->output) == 0) {
271
271
                /* we can send data immediately */
272
 
                o_stream_send(conn->output, data, data_len);
 
272
                o_stream_nsend(conn->output, data, data_len);
273
273
        } else if (conn->queue[priority]->used + data_len >=
274
274
                        REPLICATOR_MEMBUF_MAX_SIZE) {
275
275
                /* FIXME: compress duplicates, start writing to file */