Skip to content

Commit

Permalink
network: prevent UI during install with no view
Browse files Browse the repository at this point in the history
Ensure the UI is not initialized if there's no view during install when
failed to start the main proxy (e.g. the port is already in use).

Signed-off-by: thc202 <thc202@gmail.com>
  • Loading branch information
thc202 committed Oct 6, 2023
1 parent 868c3c4 commit 1f88bdb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions addOns/network/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Update default user-agents.

### Fixed
- Do not initialise the view when failed to start the main proxy in `cmd` and `daemon` modes.

## [0.11.2] - 2023-09-27
### Fixed
- Ensure the main proxy with custom port (`-port`) is stopped when initialising after installation in `cmd` and `daemon` modes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ private void startLocalServers(String overrideAddress, int overridePort, boolean
}
} catch (Exception e) {

if (!install && (daemonMode || commandLineMode)) {
if (!install && !hasView()) {
String message =
"Failed to start the main proxy: "
+ e.getClass().getName()
Expand All @@ -927,7 +927,7 @@ private void startLocalServers(String overrideAddress, int overridePort, boolean
Constant.messages.getString(
"network.cmdline.proxy.error.host.assign", address);
} else if (containsMessage(e, "denied") || containsMessage(e, "in use")) {
if (promptUserMainProxyPort()) {
if (hasView() && promptUserMainProxyPort()) {
return;
}

Expand All @@ -944,6 +944,12 @@ private void startLocalServers(String overrideAddress, int overridePort, boolean
Constant.messages.getString(
"network.cmdline.proxy.error.generic", e.getMessage());
LOGGER.warn("Failed to start the main proxy: {}", e.getMessage());
if (!hasView()) {
return;
}
} else if (!hasView()) {
LOGGER.warn("Failed to start the main proxy: {}", detailedError);
return;
}

JOptionPane.showMessageDialog(
Expand Down

0 comments on commit 1f88bdb

Please sign in to comment.