Method

GioDtlsConnectionclose

since: 2.48

Declaration [src]

gboolean
g_dtls_connection_close (
  GDtlsConnection* conn,
  GCancellable* cancellable,
  GError** error
)

Description [src]

Close the DTLS connection. This is equivalent to calling g_dtls_connection_shutdown() to shut down both sides of the connection.

Closing a GDtlsConnection waits for all buffered but untransmitted data to be sent before it completes. It then sends a close_notify DTLS alert to the peer and may wait for a close_notify to be received from the peer. It does not close the underlying GDtlsConnection:base-socket; that must be closed separately.

Once conn is closed, all other operations will return G_IO_ERROR_CLOSED. Closing a GDtlsConnection multiple times will not return an error.

GDtlsConnections will be automatically closed when the last reference is dropped, but you might want to call this function to make sure resources are released as early as possible.

If cancellable is cancelled, the GDtlsConnection may be left partially-closed and any pending untransmitted data may be lost. Call g_dtls_connection_close() again to complete closing the GDtlsConnection.

Available since: 2.48

Parameters

cancellable

Type: GCancellable

A GCancellable, or NULL.

The argument can be NULL.
The data is owned by the caller of the method.
error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE on success, FALSE otherwise.