Jump to content

Recommended Posts

  • Forum Moderator

Hello fine people,

A little bit of context, recently we have been talking with @ msnas about doing an action upon server closure. Which is what the db/game should be doing by default when it exits MainLoop. However, I noticed that because of the way I shutdown my core, I wasn't receiving the right signal and was exiting the server before I can do any other actions. He then told me that he noticed this issue a long time ago because it was also present for him, only on Windows.

Well, after a little bit of digging, I noticed that the signal was simply not handled on a Windows server. So here is a rudimentary (but working) signal management for Windows. I guess you can still rewrite the whole thing using more modern stuff like boost signal. But so far so good.

Please not that you should close your db / game using CTRL+C or CTRL+BREAK if you want to gracefully shutdown. As a forced closure (closing the window, shutdown or task manager) would still not allow for the server to properly close, notably because it doesn't give enough grace time.

  So, here is the fix:

Spoiler

This is the hidden content, please

 

Have a nice day! ?

 

Edited by Gurgarath
  • Metin2 Dev 95
  • Think 1
  • Confused 1
  • Good 22
  • Love 1
  • Love 29

Gurgarath
coming soon
My Services

Link to comment
https://metin2.dev/topic/30262-proper-signal-management-for-windows/
Share on other sites

  • Forum Moderator
2 hours ago, Seryov said:

I usually close the cores using ESC in Windows, with this change is it now possible to close using CTRL + C?

Exactly, @ Mali brought this up to me and I didn't know that I could close the server with ESC. With this change, you'll be able to use CTRL+C as well as CTRL+BREAK, indeed. Esc does a graceful shutdown as well. Note that you can already use CTRL+C without this fix, but it won't do a graceful shutdown.

Edited by Gurgarath
  • Love 1

Gurgarath
coming soon
My Services

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.