blob: ef36471d9d7017a5dabd9428a8094c7aff44b2bf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
package org.gnunet.requests;
import org.gnunet.util.AbsoluteTime;
import org.gnunet.util.Connection;
import org.gnunet.util.RelativeTime;
/**
* ...
*
* @author Florian Dold
*/
public abstract class Request {
protected AbsoluteTime deadline = AbsoluteTime.FOREVER;
/**
* Called whenever the request could not be transmitted due to timeout.
*
* @return true if the request should be queued again
*/
public boolean onTransmitTimeout() {
// per default, just drop the message on timeout!
return false;
}
/**
*
*
* @return true if the request should be kept after the destroy request
*/
public boolean onDestroy() {
// per default, do not keep on destroy
return false;
}
/**
* @return true if the request should be kept after the reconnect
*/
public boolean onReconnect() {
// per default, do not keep on reconnect
return false;
}
/**
* @param alreadyTransmitted true if message has already been sent over the network
*/
public void onCancel(boolean alreadyTransmitted) {
// do nothing
}
public void setDeadline(AbsoluteTime deadline) {
this.deadline = deadline;
}
/**
* Called to determine after how long the request should time out.
* Per default, the deadline is FOREVER.
*
* @return the deadline for this request
*/
public AbsoluteTime getDeadline() {
return deadline;
}
public abstract void transmit(Connection.MessageSink sink);
}
|