Commit 21b3ac10 authored by alangy98's avatar alangy98 Committed by Melledy
Browse files

Revert "bugfix: portbind error when falling back to http server"

This reverts commit 4817ed9c.
the bugfix is inappropriate
parent 4837ccb9
......@@ -200,6 +200,8 @@ public final class DispatchServer {
public void start() throws Exception {
HttpServer server;
if (Grasscutter.getConfig().getDispatchOptions().UseSSL) {
HttpsServer httpsServer = HttpsServer.create(getAddress(), 0);
SSLContext sslContext = SSLContext.getInstance("TLS");
try (FileInputStream fis = new FileInputStream(Grasscutter.getConfig().getDispatchOptions().KeystorePath)) {
char[] keystorePassword = Grasscutter.getConfig().getDispatchOptions().KeystorePassword.toCharArray();
KeyManagerFactory _kmf;
......@@ -232,9 +234,9 @@ public final class DispatchServer {
throw originalEx;
}
}
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(_kmf.getKeyManagers(), null, null);
HttpsServer httpsServer = HttpsServer.create(getAddress(), 0);
httpsServer.setHttpsConfigurator(new HttpsConfigurator(sslContext));
server = httpsServer;
} catch (BindException ignored) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment