Function close [src]

Closes the connection.

Prototype

pub fn close(conn: *Connection, allocator: Allocator) void

Parameters

conn: *Connectionallocator: Allocator

Source

pub fn close(conn: *Connection, allocator: Allocator) void { if (conn.protocol == .tls) { if (disable_tls) unreachable; // try to cleanly close the TLS connection, for any server that cares. _ = conn.tls_client.writeEnd(conn.stream, "", true) catch {}; if (conn.tls_client.ssl_key_log) |key_log| key_log.file.close(); allocator.destroy(conn.tls_client); } conn.stream.close(); allocator.free(conn.host); }