Fix race condition

This commit is contained in:
Flare Microsystems
2024-11-16 21:13:52 -08:00
parent 7eb283592e
commit 32203cde49

View File

@@ -17,7 +17,8 @@ public class Packet4FileData extends Packet{
public Packet4FileData(long fileId, short chunkSize, byte[] fileChunk) {
this.fileId = fileId;
this.chunkSize = chunkSize;
this.fileChunk = fileChunk;
this.fileChunk = new byte[chunkSize];
System.arraycopy(fileChunk, 0, this.fileChunk, 0, chunkSize);
}
public void recievePacket(DataInputStream in) throws IOException {
@@ -38,13 +39,11 @@ public class Packet4FileData extends Packet{
networkHandler.handlePacket(this);
}
public long getFileId()
{
public long getFileId() {
return fileId;
}
public byte[] getFileChunk()
{
public byte[] getFileChunk() {
return fileChunk;
}
@@ -53,5 +52,4 @@ public class Packet4FileData extends Packet{
return new Packet4FileData();
}
}