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; 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) { public boolean canComplete(HMessage.Direction direction, PacketInfoManager packetInfoManager) {
if (isCorrupted() || identifier == null) return false; if (isCorrupted() || identifier == null) return false;

View File

@ -231,13 +231,7 @@ public class ExtensionHandler {
@Override @Override
protected void stringToPacketRequest(String string) { protected void stringToPacketRequest(String string) {
HPacket packet = new HPacket(string); HPacket packet = new HPacket(string);
PacketInfoManager packetInfoManager = hConnection.getPacketInfoManager(); packet.maybeCompletePacket(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);
}
extension.stringToPacketResponse(packet); extension.stringToPacketResponse(packet);
} }
}; };

View File

@ -153,13 +153,7 @@ public class InjectionController extends SubForm {
// complete packet to show correct headerId // complete packet to show correct headerId
if (!packets[0].isPacketComplete()) { if (!packets[0].isPacketComplete()) {
HPacket packet = packets[0]; packets[0].maybeCompletePacket(packetInfoManager);
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);
}
} }
lbl_pcktInfo.setText("header (id:" + packets[0].headerId() + ", length:" + lbl_pcktInfo.setText("header (id:" + packets[0].headerId() + ", length:" +