Обработка выбора транспортного сервера

This commit is contained in:
RoyceDa
2026-02-10 09:26:52 +02:00
parent f8be7f5c65
commit 0c29d49c37
5 changed files with 133 additions and 7 deletions

View File

@@ -3,9 +3,11 @@ package com.rosetta.im;
import com.rosetta.im.client.ClientManager;
import com.rosetta.im.client.OnlineManager;
import com.rosetta.im.config.Configuration;
import com.rosetta.im.config.ServerConfiguration;
import com.rosetta.im.event.EventManager;
import com.rosetta.im.executors.Executor0Handshake;
import com.rosetta.im.executors.Executor11Typeing;
import com.rosetta.im.executors.Executor15RequestTransport;
import com.rosetta.im.executors.Executor1UserInfo;
import com.rosetta.im.executors.Executor24DeviceResolve;
import com.rosetta.im.executors.Executor3Search;
@@ -22,6 +24,7 @@ import com.rosetta.im.logger.enums.Color;
import com.rosetta.im.logger.enums.LogLevel;
import com.rosetta.im.packet.Packet0Handshake;
import com.rosetta.im.packet.Packet11Typeing;
import com.rosetta.im.packet.Packet15RequestTransport;
import com.rosetta.im.packet.Packet1UserInfo;
import com.rosetta.im.packet.Packet23DeviceList;
import com.rosetta.im.packet.Packet24DeviceResolve;
@@ -55,6 +58,7 @@ public class Boot {
private ClientManager clientManager;
private OnlineManager onlineManager;
private Configuration configuration;
private ServerConfiguration serverConfiguration;
public Boot() {
this.packetManager = new PacketManager();
@@ -108,7 +112,7 @@ public class Boot {
*/
public Boot bootstrap() {
try{
this.configuration.loadConfiguration();
this.serverConfiguration = this.configuration.loadConfiguration();
this.server.start();
this.registerAllPackets();
this.registerAllExecutors();
@@ -116,7 +120,7 @@ public class Boot {
this.printBootMessage();
return this;
}catch(Exception e){
this.logger.error("Booting error, stack trace:");
this.logger.error(Color.RED + "Booting error, stack trace:");
e.printStackTrace();
return null;
}
@@ -142,6 +146,7 @@ public class Boot {
this.packetManager.registerPacket(8, Packet8Delivery.class);
this.packetManager.registerPacket(9, Packet9DeviceNew.class);
this.packetManager.registerPacket(11, Packet11Typeing.class);
this.packetManager.registerPacket(15, Packet15RequestTransport.class);
this.packetManager.registerPacket(23, Packet23DeviceList.class);
this.packetManager.registerPacket(24, Packet24DeviceResolve.class);
@@ -155,6 +160,7 @@ public class Boot {
this.packetManager.registerExecutor(6, new Executor6Message(this.clientManager, this.packetManager));
this.packetManager.registerExecutor(7, new Executor7Read(this.clientManager, this.packetManager));
this.packetManager.registerExecutor(11, new Executor11Typeing(this.clientManager, this.packetManager));
this.packetManager.registerExecutor(15, new Executor15RequestTransport(this.serverConfiguration));
this.packetManager.registerExecutor(24, new Executor24DeviceResolve(this.clientManager, this.eventManager));
}