Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ssl_cert =
ssl_key =

[OPN]
Enabled = ON
IP = 0.0.0.0
ExternalIP =
Port = 8200
Expand All @@ -27,6 +28,7 @@ LogToFile = ON
LogToWindow = ON

[LMP]
Enabled = ON
IP = 0.0.0.0
ExternalIP =
Port = 8201
Expand All @@ -41,6 +43,7 @@ LogToFile = ON
LogToWindow = ON

[FMP]
Enabled = ON
IP = 0.0.0.0
ExternalIP =
Port = 8202
Expand All @@ -55,6 +58,7 @@ LogToFile = ON
LogToWindow = ON

[RFP]
Enabled = ON
IP = 0.0.0.0
ExternalIP =
Port = 8203
Expand Down
13 changes: 12 additions & 1 deletion fmp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,29 @@
import mh.pat_item as pati
from mh.constants import PatID4
from mh.pat import PatRequestHandler, PatServer
from mh.session import FMPSession
from mh.state import State
from other.utils import hexdump, server_base, server_main, to_str


class FmpServer(PatServer):
"""Basic FMP server class."""
# TODO: Backport close cache logic
pass
def __init__(self, *args, **kwargs):
PatServer.__init__(self, *args, **kwargs)
self.fmp_state = State()
# TODO: Backport the cache server registration logic instead
import mh.database as db
db.get_instance().servers = self.fmp_state.servers


class FmpRequestHandler(PatRequestHandler):
"""Basic FMP server request handler class."""

def on_init(self):
PatRequestHandler.on_init(self)
self.session = FMPSession(self.session)

def recvAnsConnection(self, packet_id, data, seq):
"""AnsConnection packet."""
connection_data = pati.ConnectionData.unpack(data)
Expand Down
7 changes: 4 additions & 3 deletions master_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ def create_servers(server_args):
has_ui = False
for module in (OPN, LMP, FMP, RFP):
server, args = create_server_from_base(*module.BASE, args=server_args)
has_ui = has_ui or args.log_to_window
servers.append(server)
if server:
has_ui = has_ui or args.log_to_window
servers.append(server)
return servers, has_ui


Expand Down Expand Up @@ -73,7 +74,7 @@ def interactive_mode(local=locals()):
if args.interactive:
t.join()
except KeyboardInterrupt:
print("Interrupt key was pressed, closing server...")
print("Interrupt key was pressed, closing servers...")
except Exception:
print('Unexpected exception caught...')
traceback.print_exc()
Expand Down
2 changes: 1 addition & 1 deletion mh/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def make_binary_trading_post():
FMP_VERSION = 1
# TODO: Backport central and NATNEG constants

TIME_STATE = 0
TIME_STATE = 0 # FIXME: Unused since quest rotation added, see time_utils
IS_JAP = False


Expand Down
Loading