MCPcopy
hub / github.com/evilsocket/opensnitch / __init__

Method __init__

ui/opensnitch/utils/__init__.py:143–160  ·  view source on GitHub ↗
(self, _interval, _callback)

Source from the content-addressed store, hash-verified

141 callback = None
142
143 def __init__(self, _interval, _callback):
144 Thread.__init__(self, name="cleaner_db_thread")
145 self.interval = _interval * 60
146 self.stop_flag = Event()
147 self.callback = _callback
148 self._cfg = Config.init()
149
150 # We need to instantiate a new QsqlDatabase object with a unique name,
151 # because it's not thread safe:
152 # "A connection can only be used from within the thread that created it."
153 # https://doc.qt.io/qt-5/threads-modules.html#threads-and-the-sql-module
154 # The filename and type is the same, the one chosen by the user.
155 self.db = Database("db-cleaner-connection")
156 self.db_status, db_error = self.db.initialize(
157 dbtype=self._cfg.getInt(self._cfg.DEFAULT_DB_TYPE_KEY),
158 dbfile=self._cfg.getSettings(self._cfg.DEFAULT_DB_FILE_KEY),
159 dbjrnl_wal=self._cfg.getBool(self._cfg.DEFAULT_DB_JRNL_WAL)
160 )
161
162 def run(self):
163 if self.db_status == False:

Callers

nothing calls this directly

Calls 8

DatabaseClass · 0.90
initMethod · 0.80
initializeMethod · 0.80
getIntMethod · 0.80
getSettingsMethod · 0.80
getBoolMethod · 0.80
EventStruct · 0.50
__init__Method · 0.45

Tested by

no test coverage detected