- /* Add our data to buffer */
- if(c->status.encryptout) {
- char outbuf[length];
- size_t outlen = length;
-
- if(!cipher_encrypt(&c->outcipher, buffer, length, outbuf, &outlen, false) || outlen != length) {
- logger(LOG_ERR, _("Error while encrypting metadata to %s (%s)"),
- c->name, c->hostname);
- return false;
- }
-
- ifdebug(META) logger(LOG_DEBUG, _("Encrypted write %p %p %p %d"), c, c->buffer, outbuf, length);
- bufferevent_write(c->buffer, (void *)outbuf, length);
- ifdebug(META) logger(LOG_DEBUG, _("Done."));
- } else {
- ifdebug(META) logger(LOG_DEBUG, _("Unencrypted write %p %p %p %d"), c, c->buffer, buffer, length);
- bufferevent_write(c->buffer, (void *)buffer, length);
- ifdebug(META) logger(LOG_DEBUG, _("Done."));