mirror of
https://github.com/evilsocket/opensnitch.git
synced 2025-03-04 08:34:40 +01:00
ui: minor refactoring
- Removed unused imports. - Moved max gRPC channel settings to config.py
This commit is contained in:
parent
c2da6d11c8
commit
c387ddf468
2 changed files with 19 additions and 15 deletions
|
@ -23,11 +23,9 @@ from PyQt5 import QtWidgets, QtGui, QtCore
|
|||
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
import signal
|
||||
import argparse
|
||||
import logging
|
||||
from threading import Timer
|
||||
|
||||
from concurrent import futures
|
||||
|
||||
|
@ -122,18 +120,7 @@ Examples:
|
|||
|
||||
print("Using server address:", args.socket)
|
||||
|
||||
maxmsglencfg = cfg.getSettings(Config.DEFAULT_SERVER_MAX_MESSAGE_LENGTH)
|
||||
if maxmsglencfg == '4MiB':
|
||||
maxmsglen = 4194304
|
||||
elif maxmsglencfg == '8MiB':
|
||||
maxmsglen = 8388608
|
||||
elif maxmsglencfg == '16MiB':
|
||||
maxmsglen = 16777216
|
||||
else:
|
||||
maxmsglen = 4194304
|
||||
|
||||
print("gRPC Max Message Length:", maxmsglencfg)
|
||||
print(" Bytes:", maxmsglen)
|
||||
maxmsglen = cfg.getMaxMsgLength()
|
||||
|
||||
service = UIService(app, on_exit)
|
||||
# @doc: https://grpc.github.io/grpc/python/grpc.html#server-object
|
||||
|
@ -179,6 +166,5 @@ Examples:
|
|||
|
||||
except KeyboardInterrupt:
|
||||
on_exit()
|
||||
|
||||
finally:
|
||||
lockfile.unlock()
|
||||
|
|
|
@ -223,3 +223,21 @@ class Config:
|
|||
Config.RULES_DURATION_FILTER = []
|
||||
except Exception as e:
|
||||
print("setRulesDurationFilter() exception:", e)
|
||||
|
||||
def getMaxMsgLength(self):
|
||||
"""return maximum configured length for the gRPC channel.
|
||||
Default size is 4MB, but in some scenarios it's not enough.
|
||||
"""
|
||||
maxmsglen = 4194304
|
||||
maxmsglencfg = self.getSettings(Config.DEFAULT_SERVER_MAX_MESSAGE_LENGTH)
|
||||
if maxmsglencfg == '4MiB':
|
||||
maxmsglen = 4194304
|
||||
elif maxmsglencfg == '8MiB':
|
||||
maxmsglen = 8388608
|
||||
elif maxmsglencfg == '16MiB':
|
||||
maxmsglen = 16777216
|
||||
|
||||
print("gRPC Max Message Length:", maxmsglencfg)
|
||||
print(" Bytes:", maxmsglen)
|
||||
|
||||
return maxmsglen
|
||||
|
|
Loading…
Add table
Reference in a new issue