-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telnet server to Alpha-Core #1352
Conversation
|
||
# Add more module starts here as needed | ||
|
||
def startTelnetCommandHandler(self, parent_conn): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure all method names use snake_case
naming convention.
utils/Logger.py
Outdated
Logger.info(msg, end='\r') | ||
else: | ||
Logger.success(msg) | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What Exception can trigger from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure I remove it.
@staticmethod | ||
def _handle_command(command_dict, parent_conn): | ||
if parent_conn: | ||
Logger.set_parent_conn(parent_conn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are already doing this in start_telnet
method, no? Maybe I'm mistaken but not sure if it's needed in both places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I made that decision because I needed to assign it within each parallell process I wanted to access. I'm sending data two way between telnet processes and the other processes with multiprocessing.Pipe()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check if I could use some other method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I had to watch my code and figure out what I was thinking.
- I pipe messages between all processes and telnet process. It's two way.
- The information I send to telnet are log messages. That why I need to stay inside the process. and that's why I got a method in Logger class to set parent_conn (for each object/ process)
- Every time Logger is called and Logger.parent_conn is set within the process. It will send all output to TelnetServer
- In Logger I made some changes, so I can change log level to telnet server separately, cos ut was driving me mad having debug output in telnet
- Telnet server can also send commands, and it's handled by CommandHandler and CommandManager in telnet module.
- basically it tap into a player session and commit the command, or use the world session.
- the reason I made another command Manager is because otherwise player will have all output, not telnet, and it also demand more feedback because you don't see there monitor.
|
||
def starts(parent_conn=None): | ||
if parent_conn: | ||
Logger.set_parent_conn(parent_conn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated / redundant assignment too? Not sure.
main.py
Outdated
if launch_world: | ||
world_process = context.Process(target=WorldManager.WorldServerSessionHandler.start) | ||
world_process = context.Process(target=WorldManager.WorldServerSessionHandler.start,args=(world_conn,)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space.
def start(parent_conn=None): | ||
|
||
if parent_conn: | ||
Logger.set_parent_conn(parent_conn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, redundant / duplicated code? Also extra newline on top.
def start_realm(parent_conn=None): | ||
|
||
if parent_conn: | ||
Logger.set_parent_conn(parent_conn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as other comments.
def start_proxy(): | ||
def start_proxy(parent_conn=None): | ||
if parent_conn: | ||
Logger.set_parent_conn(parent_conn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as other comments.
utils/DatabaseManager.py
Outdated
Logger.info("MySQL didn't become ready within 2 minutes") | ||
exit(1) | ||
|
||
test() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this class being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh it was a test I made for main process to halt until DB is up and running. It's not used.
Why the Logger.py file has been deleted? |
not sure, by mistake I believe |
btw not sure what database-update.sh is not called docker-database-update.sh or something. Is in main folder, and one would assume it's for everyone, not only for docker users |
database-update.sh it's just a standalone script for updating the database |
So it will work on my windows setup? I don't use docker |
hmm not it's for docker, but I can do a small rewrite so it can work for both |
etc/docker/sql/build_sql_patches.sh that's where this repo have sql scripts for docker I believd |
In top directory is quite confusing. And making it work on windows doesn't seem worth the effort as there can be any amount of setups with different mariadb versions etc... |
Just basic commands, more in the future
Activate it in config.yml
run make to see a list of commands from shell