Fix race condition
This commit is contained in:
@@ -6,18 +6,19 @@ import java.io.IOException;
|
||||
|
||||
import com.flaremicro.crossjeeves.net.NetworkHandler;
|
||||
|
||||
public class Packet4FileData extends Packet{
|
||||
public class Packet4FileData extends Packet {
|
||||
private long fileId;
|
||||
private short chunkSize;
|
||||
private byte[] fileChunk;
|
||||
|
||||
public Packet4FileData(){
|
||||
public Packet4FileData() {
|
||||
}
|
||||
|
||||
public Packet4FileData(long fileId, short chunkSize, byte[] fileChunk){
|
||||
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 {
|
||||
@@ -34,17 +35,15 @@ public class Packet4FileData extends Packet{
|
||||
out.write(fileChunk, 0, chunkSize);
|
||||
}
|
||||
|
||||
public void processPacket(NetworkHandler networkHandler){
|
||||
public void processPacket(NetworkHandler networkHandler) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user