Skip to content

Commit

Permalink
Add message RedirectServerAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
numbaa committed Apr 28, 2024
1 parent 38f44b4 commit 6aff288
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ public void onConnectionUnexpectedlyClosed(long connectionID) {
public LtMessage handleLoginDevice(long connectionID, LoginDeviceProto.LoginDevice msg) {
//注意与ControllingController的区别
log.info("Handle LoginDevice(connectionID:{}, deviceID:{})", connectionID, msg.getDeviceId());
var someCondition = false;
if (someCondition) {
var redirect = RedirectServerAddressProto.RedirectServerAddress.newBuilder();
redirect.setHost("somehost");
redirect.setPort(1234);
return new LtMessage(LtProto.RedirectServerAddress.ID, redirect.build());
}
var ack = LoginDeviceAckProto.LoginDeviceAck.newBuilder();
UsedID usedID = deviceIDService.getUsedDeviceID(msg.getDeviceId());
if (usedID == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ public LtMessage handleAllocateDeviceID(long connectionID, AllocateDeviceIDProto
public LtMessage handleLoginDevice(long connectionID, LoginDeviceProto.LoginDevice msg) {
//注意与ControlledController的区别
log.info("Handle LoginDevice(connectionID:{}, deviceID:{})", connectionID, msg.getDeviceId());
var someCondition = false;
if (someCondition) {
var redirect = RedirectServerAddressProto.RedirectServerAddress.newBuilder();
redirect.setHost("somehost");
redirect.setPort(1234);
return new LtMessage(LtProto.RedirectServerAddress.ID, redirect.build());
}
var ack = LoginDeviceAckProto.LoginDeviceAck.newBuilder();
UsedID usedID = deviceIDService.getUsedDeviceID(msg.getDeviceId());
if (usedID == null) {
Expand Down

0 comments on commit 6aff288

Please sign in to comment.