diff --git a/quic/ngtcp2/connection.nim b/quic/ngtcp2/connection.nim index 5f29cd7..8dcad6f 100644 --- a/quic/ngtcp2/connection.nim +++ b/quic/ngtcp2/connection.nim @@ -1,11 +1,13 @@ import ngtcp2 import path -type Connection* = object - conn*: ptr ngtcp2_conn - path*: Path +type + Connection* = ref ConnectionObj + ConnectionObj = object + conn*: ptr ngtcp2_conn + path*: Path -proc `=destroy`*(connection: var Connection) = +proc `=destroy`*(connection: var ConnectionObj) = if connection.conn != nil: ngtcp2_conn_del(connection.conn) connection.conn = nil