3 import org.simgrid.msg.Task;
5 * Tasks sent between peers
7 public class MessageTask extends Task {
20 public String issuerHostname;
21 public String mailbox;
23 public char bitfield[];
25 public int blockIndex;
26 public int blockLength;
27 public boolean stalled;
29 * Constructor, builds a value-less message
31 * @param issuerHostname
35 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId) {
36 this(type,issuerHostname,mailbox,peerId,-1,false,-1,-1);
39 * Constructor, builds a new "have/request/piece" message
41 * @param issuerHostname
46 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, int index) {
47 this(type,issuerHostname,mailbox,peerId,index,false,-1,-1);
50 * Constructor, builds a new bitfield message
52 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, char bitfield[]) {
53 this(type,issuerHostname,mailbox,peerId,-1,false,-1,-1);
54 this.bitfield = bitfield;
57 * Constructor, build a new "request" message
59 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, int index, int blockIndex, int blockLength) {
60 this(type,issuerHostname,mailbox,peerId,index,false,blockIndex,blockLength);
63 * Constructor, build a new "piece" message
65 public MessageTask(Type type, String issuerHostname, String mailbox, int peerId, int index, boolean stalled, int blockIndex, int blockLength) {
67 this.issuerHostname = issuerHostname;
68 this.mailbox = mailbox;
71 this.stalled = stalled;
72 this.blockIndex = blockIndex;
73 this.blockLength = blockLength;