Skip to content

Commit 29fdc63

Browse files
committed
quit ftp connection when finished
1 parent edac6c0 commit 29fdc63

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

gnss_lib_py/parsers/ephemeris.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import os
2929
import shutil
3030
import gzip
31-
import socket
3231
import ftplib
3332
from ftplib import FTP_TLS, FTP
3433
from datetime import datetime, timezone
@@ -430,6 +429,7 @@ def retrieve_file(self, url, directory, filename, dest_filepath):
430429
raise ftplib.error_perm(str(err) + ' Failed to retrieve ' \
431430
+ src_filepath + ' from ' + url)
432431

432+
ftp.quit()
433433
self.decompress_file(dest_filepath)
434434

435435
def decompress_file(self, filepath):
@@ -472,12 +472,10 @@ def connect(self, url, secure):
472472
if secure:
473473
ftp = FTP_TLS(url)
474474
ftp.login()
475-
ftp.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
476475
ftp.prot_p()
477476
else:
478477
ftp = FTP(url)
479478
ftp.login()
480-
ftp.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
481479
return ftp
482480

483481
@staticmethod

0 commit comments

Comments
 (0)