/*
** Copyright (C) 2006 Thadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
-** Copyright (C) 2009 Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
+** Copyright (C) 2009 Thadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
}
if (r == 0)
{
- gnutls_transport_set_global_errno (EAGAIN);
+ errno = (EAGAIN);
return -1;
}
return r;
}
static void
-ssl_server_handshake (struct ssl_data *ssl)
+ssl_server_handshake (HCConn *conn)
{
+ struct ssl_data *ssl = conn->layer;
int error;
if ((error = gnutls_handshake (ssl->session)) < 0)
{
else
{
ssl->handshaking = FALSE;
+ if (conn->func)
+ conn->func (conn, HC_EVENT_CONNECT, conn->data);
}
}
gnutls_transport_set_push_function (ssl->session, ssl_push);
gnutls_transport_set_pull_function (ssl->session, ssl_pull);
ssl->handshaking = TRUE;
- ssl_server_handshake (ssl);
+ ssl_server_handshake (conn);
}
static void
case HC_EVENT_READ:
if (ssl->handshaking)
{
- ssl_server_handshake (ssl);
+ ssl_server_handshake (ssl_conn);
/* FIXME: create HC_CONN_ERROR */
if (ssl->failed && ssl_conn->func)
ssl_conn->func (ssl_conn, HC_EVENT_CLOSE, ssl_conn->data);
{
return hc_conn_set_driver_ssl (conn, lowconn, 1);
}
+
+void
+hc_conn_ssl_server_set_priority (HCConn *conn, char *priority)
+{
+ struct ssl_data *ssl;
+ ssl = conn->layer;
+ gnutls_priority_set_direct (ssl->session, priority, NULL);
+}