EV-Redis

 view release on metacpan or  search on metacpan

src/EV__Redis.xs  view on Meta::CPAN

        /* before invoking: a reply in a re-entered loop must find it skipped */
        cbt->skipped = 1;

        /* reply_cb's skipped path may unlink it again */
        ngx_queue_init(q);
        if (!cbt->persist) drop_pending(self, cbt);

        /* take cb first: reply_cb may free cbt while the callback runs */
        if (NULL != cbt->cb) {
            SV* cb_to_invoke = cbt->cb;
            cbt->cb = NULL;

            invoke_callback_error(cb_to_invoke, err_skipped);
            SvREFCNT_dec(cb_to_invoke);
        }
    }

    self->in_cb_cleanup = 0;

    /* skipping releases slots for commands the callbacks issued */
    if (self->magic == EV_REDIS_MAGIC) send_next_waiting(self);

    self->callback_depth--;
    check_destroyed(self);
}

void
_warn(const char* what, SV* err, SV* msg);
CODE:
    sv_setpvf(msg, "EV::Redis: exception in %s: %" SVf, what, SVfARG(err));
    warn("%" SVf, SVfARG(msg));

int
has_ssl(char* class);
CODE:
{
    PERL_UNUSED_VAR(class);
#ifdef EV_REDIS_SSL
    RETVAL = 1;
#else
    RETVAL = 0;
#endif
}
OUTPUT:
    RETVAL

#ifdef EV_REDIS_SSL

void
_setup_ssl_context(EV::Redis self, SV* cacert, SV* capath, SV* cert, SV* key, SV* server_name, int verify = 1);
CODE:
{
    redisSSLContextError ssl_error = REDIS_SSL_CTX_NONE;
    redisSSLContext* new_ctx;
    redisSSLOptions ssl_opts;

    memset(&ssl_opts, 0, sizeof(ssl_opts));
    ssl_opts.cacert_filename = (SvOK(cacert)) ? c_string(cacert, "tls_ca") : NULL;
    ssl_opts.capath = (SvOK(capath)) ? c_string(capath, "tls_capath") : NULL;
    ssl_opts.cert_filename = (SvOK(cert)) ? c_string(cert, "tls_cert") : NULL;
    ssl_opts.private_key_filename = (SvOK(key)) ? c_string(key, "tls_key") : NULL;
    ssl_opts.server_name = (SvOK(server_name)) ? c_string(server_name, "tls_server_name") : NULL;
    ssl_opts.verify_mode = verify ? REDIS_SSL_VERIFY_PEER : REDIS_SSL_VERIFY_NONE;

    /* create first: a failed (eval-trapped) reconfigure must not leave
     * ssl_ctx NULL, or the next reconnect goes plaintext */
    new_ctx = redisCreateSSLContextWithOptions(&ssl_opts, &ssl_error);
    if (NULL == new_ctx) {
        croak_caller("SSL context creation failed: %s", redisSSLContextGetError(ssl_error));
    }

    if (NULL != self->ssl_ctx) {
        redisFreeSSLContext(self->ssl_ctx);
    }
    self->ssl_ctx = new_ctx;
}

#endif



( run in 0.942 second using v1.01-cache-2.11-cpan-8379b9b8ec2 )