crowbarmaster / BedrockManagementService

A multiple host, multiple server, Minecraft bedrock server management service and GUI manager.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Stop/disable a particular server until you start it manually

demifiend9 opened this issue · comments

commented

I run multiple servers but don't want all of them to be running all the time.

If I send stop command to the server it restarts automatically. I need it stopped until I start it again.

Perhaps a Stop (or disable) selected server button besides the Restart selected server button?
Or checkboxes before the server names in the server list, which if you uncheck sends a stop signal to the server without restarting it until you check it again.

Hello and thank you for your input! This can be easily added. I hadn't included a stop button as I didn't feel anyone would benefit from it, and would eat space on the GUI. I will tinker tomorrow with what looks right; the logic side of things already has a stop feature, just not one you, the user, can trigger without watchdog taking over. Thanks again!

commented

Thanks for the awesome program and the quick reply.

The reason this would benefit me is that I have one main server which I need running all time and few test servers where I test out different mods and stuff and I only want them running when I need them so they don't hog up resources.

There can be two implementation, a stop server function which stop the server but the server starts normally when BMS restarts (like when rebooting PC), and a disable server function where even after BMS service restarts the server is not started.

Personally If I had to choose between the two would prefer the latter, but since this program is already the most powerful server manager for bedrock and intends to be feature rich, both option could be present. For example, a stop server button to temporarily stop server and a check box in the server list to persistently disable/enable server.

I always thought it was odd that there was no stop server button too. I could have used that a few times. But I guess you would have to account for a Windows service that is running all the time yet the MC server may or may not be.

Started working on the tricky part to all of this this morning: Re-arranging the GUI:
image

Up until now the servers themselves have not had any persistent settings besides the MC server's own settings and Start commands. You guys will be getting an Expert server options form where you will find a checked box of settings like this. I figure there may be a few more things that can go here I simply decided wouldn't be of much use to the general user. You are more than welcome to shoot ideas for that!

Take it for what’s it is worth, but if you are changing the UI layout a little, the large text window on the left would be better as a 2 tabbed box, where one tab is the server output and the other tab is the service logs. Switching views with the checkbox is a little outside application design norms.

Hard at work on this today! I have a small factor to shed some light on here. There is an issue where a server using non-default ports still consumes the default ports as outgoing anyways. This causes a server that uses the default ports as listen ports to loop infinitely until the ports are freed. This is a apparent issue when pulling the default server out of a stopped state after the other server has been restarted.

This leaves me with a decision to make, either the server consuming the default ports will have to ignore start/stop capability, or keep track of outgoing port usage in order to stop the server currently using that port set, then continue with starting both servers in order. Either way, a server using the default ports will have to be immune from automatic start disable.

@tiamat2012 the large text window on the left would be better as a 2 tabbed box
Something like this:
image
I actually messed with tab pages a while back. Up till recently the client hadn't changed much and held more debugging purposes, and the checkbox required far less code. It will be a bit before I can wrap that up, but it should work well!

commented

Keeping track of port usage seems more complicated than its worth. If there are multiple servers currently running and one of them uses default ports, then maybe make the disable/stop button greyed out on that server, and give a warning tooltip/message about default ports while using multiple servers.

Basic users will just use one server and since some of this is under Expert server options they won't be affected.

My request turned out to be lot more than I thought haha

Hey, no worries! One of the biggest issues a start/stop feature didn't exist in the first place is I couldn't fathom a use for one - in which your scenario changed my perspective. The image above actually shows the start/stop feature working in action. However starting a disabled server caused some issues, as well as the inverse. I'm working things in as I go, should all fall together soon enough!

@crowbarmaster I think the tabbed logs look great.

I feel your pain with the default ports, which is why I ended up running VM’s for each bedrock server when I had multiple worlds. Xbox doesn’t allow you to specify a port, so I have to give each server a different ip and leave the default port alone. For mobile, people can specify ports, so it does depend on who is playing whether or not you can run multiple servers on the same host. I don’t have a suggestion for your dilemma. I wish Mojang would fix their server to only listen on the ports we configure instead of us having to work around it!

The tab look is great! Don’t forget to remove the checkbox at the bottom if you do finish implementing it. You could move the scroll lock checkbox to be at the same level as the tabs and aligned on the right. Then you could extend the box all the way to the bottom to get more lines on the screen.

I feel your pain with the default ports, which is why I ended up running VM’s for each bedrock server when I had multiple worlds. Xbox doesn’t allow you to specify a port, so I have to give each server a different ip and leave the default port alone. For mobile, people can specify ports, so it does depend on who is playing wether or not you can run multiple servers on the same host. I don’t have a suggestion for your dilemma. I wish Mojang would fix their server to only listen on the ports we configure instead of us having to work around it!

The tab look is great! Don’t forget to remove the checkbox at the bottom if you do finish implementing it. You could move the scroll lock checkbox to be at the same level as the tabs and aligned on the right. Then you could extend the box all the way to the bottom to get more lines on the screen.

It makes no sense, They should disallow the use of those ports as outgoing - the only reason this whole disaster is an issue. Regardless, I have done the best I can for now! Your test servers will have total control, and I have taken a few precautions in preventing the default server from autostart disabled or stopped.

The checkbox cannot go there unfortunately as that is still space that belongs to the tab controller. However, that last button is removed and replaced to look like this:
image
This image is a little of everything, and most of it is almost ready! Hopefully there will be time before the end of the week to ship out a new beta!

You can even slide the tabs up a little to the same height as “Connect to host”

I can see another issue where people want to change the order that servers on the same host start, so that the right one starts first and takes those default ports. How is that controlled anyway if you have more than one server?

commented

It makes no sense, They should disallow the use of those ports as outgoing - the only reason this whole disaster is an issue.

AFAIK the reason mojang designed it this way is because bedrock clients look for default port for LAN discovery functionality. So if a server is not using default port, clients in the same LAN can still list the server without having to manually add server.

But yeah, it creates much more problems than it intends to solve.

You can even slide the tabs up a little to the same height as “Connect to host”

Hows this look?

image

I can see another issue where people want to change the order that servers on the same host start, so that the right one starts first and takes those default ports. How is that controlled anyway if you have more than one server?

All I do now to verify this is check the current configuration for the primary ports after loading, and insert it to the beginning of the array of server infos. Servers are launched in this order, so placing the config at the front of the array will ensure it is also launched first. There should be a note placed in the readme warning the user of this possible conflict, as well as confirmed solutions.

It makes no sense, They should disallow the use of those ports as outgoing - the only reason this whole disaster is an issue.

AFAIK the reason mojang designed it this way is because bedrock clients look for default port for LAN discovery functionality. So if a server is not using default port, clients in the same LAN can still list the server without having to manually add server.

But yeah, it creates much more problems than it intends to solve.

This much of it is the part that makes sense, the ports we set in the server.properties file are the listening ports. What I don't get, and the part that bones us, is that Bedrock server also opens up two more ports for outgoing connections...
image
and as you can see, it used the primary ports for it (the ports I set are the two above "Server started."). This is the same "testy" server as above and when the primary ports are not free, you get random ports > 50k range. They simply don't need to use them here period, but will.
Edit: I found a whole forum page of info on the subject, and the verdict is it's still hard to tell exactly the usage for those ports. They seem to function exactly the same as the ports we set, and they have no documentation whatsoever. People have been posting bug topics about it for almost a year now.

The screen layout looks great! You can probably just not show the reserved buttons and leave that space blank for now. (and leave edit client config button where it is). I don't think people would complain it is not perfectly symmetrical.

As far as the 19132/3 ports, it's a terrible design. If I run a webserver on something other than port 80/443, the server doesn't also forcibly listen on http and https ports automatically because someone wants to just type in the DNS name or IP and be discovered. They changed from the default for a reason and they may want to run more than one webserver on alternate ports (of which their browser clients have to know the port number!) I know of no other software that you can configure a custom port and it opens that plus the default port with no way to disable that "feature". If you want discovery capability, there are other methods to do so. And for the XBOX specifically to only find servers only on the 19132/3 ports on the local LAN seems to be purely to force people into locally hosted servers or realms. If they gave you the option to specify a port, they would have to give you the option to specify the hostname too, and that would open it up to Internet servers and take away business from realms. I am surprised they even let you specify the port these days in the bedrock server properties.

BTW - I suspect the way it is coded is that bedrock always has to listen on 2 IPV4 ports and 2 IPV6 ports. The logic probably follows that if you use the default ports in server properties, then the second ports are random (and never used). If you specified custom ports, those are the first to open (only usable by mobile players), then the second are the default 19132/3 (for discovery and probably in use when you play from an XBOX or a "LAN game"). And if those 19132/3 ports are already in use, it picks 2 random ports (again never used), because it is simply hard wired to always open 2 sets of ports. I haven't tried to capture network traffic to verify that, as I just chalk it up as "bad design, can't fix, not worth my time" and run 1 server on the default ports per VM.

Technically, if you really want, you could take up those 2 default ports with some other simple listener (only 1 process can "listen" on a specific port) and then all your bedrock servers started afterward would listen on the custom ports primary, and random ports secondary, and none of them would be auto discovered via XBOX or "LAN Game".

New build has been pushed to Pre-releases! Enjoy guys!

@crowbarmaster I don't recall seeing it in the previous version, but I appreciate that you are printing both the service version and client version in the respective log tabs.

commented

@crowbarmaster I noticed a couple of bugs with the new build and I'm not sure where I'm supposed to post them so I'll write them down here.

  1. Deploy new server is not working. I get this in the log:

Service: Object reference not set to an instance of an object. at BedrockService.Service.Management.ConfigManager.SaveServerConfiguration(IServerConfiguration server) in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Management\ConfigManager.cs:line 160 at BedrockService.Service.Networking.NetworkStrategies.AddNewServer.ParseMessage(Byte[] data, Byte serverIndex) in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Networking\NetworkStrategies\AddNewServer.cs:line 38 at BedrockService.Service.Networking.TCPListener.<IncomingListener>b__27_0() in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Networking\TCPListener.cs:line 199

  1. Client loses connection to host when I edit global service setting. Have to press connect again.

@crowbarmaster I noticed a couple of bugs with the new build and I'm not sure where I'm supposed to post them so I'll write them down here.

  1. Deploy new server is not working. I get this in the log:

Service: Object reference not set to an instance of an object. at BedrockService.Service.Management.ConfigManager.SaveServerConfiguration(IServerConfiguration server) in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Management\ConfigManager.cs:line 160 at BedrockService.Service.Networking.NetworkStrategies.AddNewServer.ParseMessage(Byte[] data, Byte serverIndex) in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Networking\NetworkStrategies\AddNewServer.cs:line 38 at BedrockService.Service.Networking.TCPListener.<IncomingListener>b__27_0() in D:\a\BedrockManagementService\BedrockManagementService\BedrockService\Service\Networking\TCPListener.cs:line 199

  1. Client loses connection to host when I edit global service setting. Have to press connect again.

I will take a peek at that error! Client loosing connection after the global edit is a minor defect to the way things are at the moment. Things were buggy back when I wrote the procedure for that, and asking the client to auto-reconnect was difficult to time correctly. I will chase that down someday, lol.

Figured that issue out! I'm going to work out a couple more things, and will push a new dev build!

More work has gone into this, and seems quite stable! Please open any issues as you see fit, Thanks guys! Closing issue!