mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-23 03:25:56 +00:00
Ports: name Windows reservations at once, move the database to a free port
A reserved or taken database port no longer fails the start after 30 seconds: the launcher recognises Windows excluded ranges (netsh), moves MySQL to a free port and records it in Settings/repack.json. Only the server's own services use that port. The database connection of with_database is rebuilt after the start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8a313b83b8
commit
20d4c3351e
4 files changed
+240
-17
No files matched your search
@@ -308,7 +308,9 @@ pub fn with_database<T>(root: &Path, f: impl FnOnce(&Db) -> Result<T>) -> Result
|
||||
let db = Db::from_repack(root, Account::Admin)?;
|
||||
let observed = process::observe(root, &read_ports(root));
|
||||
let mysql_was_up = observed.mysql.state == ServiceState::Running && db.ping();
|
||||
if !mysql_was_up {
|
||||
let db = if mysql_was_up {
|
||||
db
|
||||
} else {
|
||||
let out = driver::run(root, Verb::StartMysql)?;
|
||||
if !out.ok {
|
||||
// Keep the launcher's own last lines: the title alone ("Something went wrong") hides the cause.
|
||||
@@ -317,7 +319,9 @@ pub fn with_database<T>(root: &Path, f: impl FnOnce(&Db) -> Result<T>) -> Result
|
||||
driver::startup_failure(root, &out)
|
||||
)));
|
||||
}
|
||||
}
|
||||
// The start may have moved the database to another port (a reserved or taken one).
|
||||
Db::from_repack(root, Account::Admin)?
|
||||
};
|
||||
let result = f(&db);
|
||||
if !mysql_was_up {
|
||||
let now = process::observe(root, &read_ports(root));
|
||||
|
||||
Reference in new issue
Block a user