From a9a5c853edad551e89862752f526cf084a06418b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Kri=C5=A1tofi=C4=87?= Date: Sat, 4 Jan 2020 12:29:33 +0100 Subject: [PATCH] #5 Added destructor to the Streamer class Added the destructor method to the Streamer class which closes the opened socket. --- client/modules/Streamer.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/modules/Streamer.py b/client/modules/Streamer.py index b57d987..bd655da 100644 --- a/client/modules/Streamer.py +++ b/client/modules/Streamer.py @@ -13,6 +13,13 @@ def __init__(self, host, port, recorder): self.server_address = (host, port) self.camera = recorder + ''' + Finalizer which is called after all the references to the object + have been deleted. + ''' + def __del__(self): + self.sock.close() + ''' Gets a frame from camera and sends it to the server via UDP. '''