Source code: Freenet/message/InsertReply.java
1 package Freenet.message;
2 import Freenet.*;
3 import Freenet.node.*;
4 import Freenet.support.Logger;
5 import java.io.*;
6
7 public class InsertReply extends Message {
8
9 public static final String messageName = "InsertReply";
10
11 public InsertReply(long idnum, long htl) {
12 super(idnum, htl, (long)0);
13 }
14
15 public InsertReply(RawMessage raw) throws InvalidMessageException {
16 super(raw);
17 }
18
19 public RawMessage toRawMessage() {
20 RawMessage raw=super.toRawMessage();
21 raw.messageType="InsertReply";
22 return raw;
23 }
24
25 public MessageMemory pReceived(Node n, MessageMemory sb) {
26 if(sb==null || !(sb instanceof KeyedMM)) // No one requested this, or I forgot about it
27 return null;
28 else { // Forward it to whoever requested insert.
29 KeyedMM kmm = (KeyedMM) sb;
30 Node.timer.cancel(id);
31
32 try {
33 kmm.replyCon = sendBack(n, kmm);
34 } catch (SendFailedException sfe) {
35 Logger.log("message/TimedOut.java","Send failed on return to " + sfe.peer,Logger.NORMAL);
36 return null;
37 }
38
39 //data sent should now be sent back up the path of this message
40 kmm.dataref = source;
41 kmm.replyCon = receivedWith;
42
43 return kmm;
44 }
45 }
46
47 protected MessageMemory timeOut(Node n, MessageMemory sb)
48 {
49 Logger.log("message/TimedOut.java","Errant InsertReply message died",Logger.NORMAL);
50 return null;
51 }
52 }