Fix: Connection should be passed by reference to avoid double free
This commit is contained in:
parent
7dca48fffb
commit
dece29fdfa
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue