Re: [Vala] How to use TlsServerConnection in Vala?
- From: Luca Bruno <lethalman88 gmail com>
- To: "marcin saepia net" <marcin saepia net>
- Cc: vala-list gnome org
- Subject: Re: [Vala] How to use TlsServerConnection in Vala?
- Date: Fri, 24 Feb 2012 17:31:02 +0100
There's a static method:
http://unstable.valadoc.org/#!api=gio-2.0/GLib.TlsServerConnection.new
On Fri, Feb 24, 2012 at 4:22 PM, marcin saepia net <marcin saepia net>wrote:
Hi,
I am trying to get representation of code below in Vala.
Especially I mean the line
test->server_connection = g_tls_server_connection_new
(G_IO_STREAM(connection), cert, &error);
I just want to use TlsServerConnection on my SocketService to handle
TLS streams. I've checked n the vapi that TlsServerConnection seems to
be interface not class or struct so obviously trying to initialize it
in that way:
new TlsServerConnection(connection)
does not work.
How to do that? Any help will be appreciated,
The original code:
static gboolean
on_incoming_connection (GSocketService *service,
GSocketConnection *connection,
GObject *source_object,
gpointer user_data)
{
Test *test = user_data;
GOutputStream *stream;
GTlsCertificate *cert;
GError *error = NULL;
gchar *path;
path = g_build_filename (SRCDIR, "tls-tests", "server-and-key.pem", NULL);
cert = g_tls_certificate_new_from_file (path, &error);
g_assert_no_error (error);
g_free (path);
test->server_connection = g_tls_server_connection_new
(G_IO_STREAM(connection), cert, &error);
g_assert_no_error (error);
g_object_unref (cert);
stream = g_io_stream_get_output_stream (test->server_connection);
g_output_stream_write_async (stream, TEST_DATA, TEST_DATA_LENGTH,
G_PRIORITY_DEFAULT, NULL, on_output_write_finish, test);
return FALSE;
}
--
www.debian.org - The Universal Operating System
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]