diff --git a/magicoca/chan.py b/magicoca/chan.py index b5b9307..b4a7de9 100644 --- a/magicoca/chan.py +++ b/magicoca/chan.py @@ -110,3 +110,9 @@ class Chan(Generic[T]): Returns: """ self.recv_conn, other.recv_conn = other.recv_conn, self.recv_conn + + def __del__(self): + """ + Close the channel when the object is deleted. + """ + self.close()