This commit is contained in:
sirjonasxx 2021-04-28 15:42:09 +02:00
parent 35d18da4da
commit 0132978fb9
3 changed files with 11 additions and 14 deletions

View File

@ -108,6 +108,15 @@ public class HPacket implements StringifyAble {
isEdited = wasEdited;
}
public void maybeCompletePacket(PacketInfoManager packetInfoManager) {
if (canComplete(HMessage.Direction.TOCLIENT, packetInfoManager) && !canComplete(HMessage.Direction.TOSERVER, packetInfoManager)) {
completePacket(HMessage.Direction.TOCLIENT, packetInfoManager);
}
else if (!canComplete(HMessage.Direction.TOCLIENT, packetInfoManager) && canComplete(HMessage.Direction.TOSERVER, packetInfoManager)) {
completePacket(HMessage.Direction.TOSERVER, packetInfoManager);
}
}
public boolean canComplete(HMessage.Direction direction, PacketInfoManager packetInfoManager) {
if (isCorrupted() || identifier == null) return false;

View File

@ -231,13 +231,7 @@ public class ExtensionHandler {
@Override
protected void stringToPacketRequest(String string) {
HPacket packet = new HPacket(string);
PacketInfoManager packetInfoManager = hConnection.getPacketInfoManager();
if (packet.canComplete(HMessage.Direction.TOCLIENT, packetInfoManager) && !packet.canComplete(HMessage.Direction.TOSERVER, packetInfoManager)) {
packet.completePacket(HMessage.Direction.TOCLIENT, packetInfoManager);
}
else if (!packet.canComplete(HMessage.Direction.TOCLIENT, packetInfoManager) && packet.canComplete(HMessage.Direction.TOSERVER, packetInfoManager)) {
packet.completePacket(HMessage.Direction.TOSERVER, packetInfoManager);
}
packet.maybeCompletePacket(hConnection.getPacketInfoManager());
extension.stringToPacketResponse(packet);
}
};

View File

@ -153,13 +153,7 @@ public class InjectionController extends SubForm {
// complete packet to show correct headerId
if (!packets[0].isPacketComplete()) {
HPacket packet = packets[0];
if (packet.canComplete(HMessage.Direction.TOCLIENT, packetInfoManager) && !packet.canComplete(HMessage.Direction.TOSERVER, packetInfoManager)) {
packet.completePacket(HMessage.Direction.TOCLIENT, packetInfoManager);
}
else if (!packet.canComplete(HMessage.Direction.TOCLIENT, packetInfoManager) && packet.canComplete(HMessage.Direction.TOSERVER, packetInfoManager)) {
packet.completePacket(HMessage.Direction.TOSERVER, packetInfoManager);
}
packets[0].maybeCompletePacket(packetInfoManager);
}
lbl_pcktInfo.setText("header (id:" + packets[0].headerId() + ", length:" +