public class SprayAndWaitRouter extends ActiveRouter
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BINARY_MODE
identifier for the binary-mode setting ("binaryMode")
|
protected int |
initialNrofCopies |
protected boolean |
isBinary |
static java.lang.String |
MSG_COUNT_PROPERTY
Message property key
|
static java.lang.String |
NROF_COPIES
identifier for the initial number of copies setting ("nrofCopies")
|
static java.lang.String |
SPRAYANDWAIT_NS
SprayAndWait router's settings name space ("SprayAndWaitRouter")
|
DELETE_DELIVERED_S, deleteDelivered, RESPONSE_PREFIX, sendingConnectionsB_SIZE_S, DENIED_LOW_RESOURCES, DENIED_NO_SPACE, DENIED_OLD, DENIED_POLICY, DENIED_TTL, DENIED_UNSPECIFIED, MSG_TTL_S, msgTtl, Q_MODE_FIFO, Q_MODE_RANDOM, RCV_OK, SEND_QUEUE_MODE_S, TRY_LATER_BUSY| Modifier | Constructor and Description |
|---|---|
|
SprayAndWaitRouter(Settings s) |
protected |
SprayAndWaitRouter(SprayAndWaitRouter r)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
createNewMessage(Message msg)
Creates a new message to the router.
|
protected java.util.List<Message> |
getMessagesWithCopiesLeft()
Creates and returns a list of messages this router is currently
carrying and still has copies left to distribute (nrof copies > 1).
|
Message |
messageTransferred(java.lang.String id,
DTNHost from)
This method should be called (on the receiving host) after a message
was successfully transferred.
|
int |
receiveMessage(Message m,
DTNHost from)
Try to start receiving a message from another host.
|
SprayAndWaitRouter |
replicate()
Creates a replicate of this router.
|
protected void |
transferDone(Connection con)
Called just before a transfer is finalized (by
ActiveRouter.update()). |
void |
update()
Checks out all sending connections to finalize the ready ones
and abort those whose connection went down.
|
addToSendingConnections, canStartTransfer, changedConnection, checkReceiving, dropExpiredMessages, exchangeDeliverableMessages, getConnections, getMessagesForConnected, getNextMessageToRemove, getRoutingInfo, hasEnergy, init, isSending, isTransferring, makeRoomForMessage, makeRoomForNewMessage, requestDeliverableMessages, shuffleMessages, startTransfer, transferAborted, tryAllMessages, tryAllMessagesToAllConnections, tryMessagesForConnected, tryMessagesToConnectionsaddApplication, addToMessages, compareByQueueMode, deleteMessage, getApplications, getBufferSize, getFreeBufferSize, getHost, getMessage, getMessageCollection, getNrofMessages, hasMessage, isBlacklistedMessage, isDeliveredMessage, isIncomingMessage, messageAborted, putToIncomingBuffer, removeFromIncomingBuffer, removeFromMessages, sendMessage, sortByQueueMode, toStringpublic static final java.lang.String NROF_COPIES
public static final java.lang.String BINARY_MODE
public static final java.lang.String SPRAYANDWAIT_NS
public static final java.lang.String MSG_COUNT_PROPERTY
protected int initialNrofCopies
protected boolean isBinary
public SprayAndWaitRouter(Settings s)
protected SprayAndWaitRouter(SprayAndWaitRouter r)
r - The router prototype where setting values are copied frompublic int receiveMessage(Message m, DTNHost from)
MessageRouterreceiveMessage in class ActiveRouterm - Message to put in the receiving bufferfrom - Who the message is frompublic Message messageTransferred(java.lang.String id, DTNHost from)
MessageRoutermessageTransferred in class ActiveRouterid - Id of the transferred messagefrom - Host the message was from (previous hop)public boolean createNewMessage(Message msg)
MessageRoutercreateNewMessage in class ActiveRoutermsg - The message to createpublic void update()
ActiveRouterupdate in class ActiveRouterActiveRouter.addToSendingConnections(Connection)protected java.util.List<Message> getMessagesWithCopiesLeft()
protected void transferDone(Connection con)
ActiveRouter.update()).
Reduces the number of copies we have left for a message.
In binary Spray and Wait, sending host is left with floor(n/2) copies,
but in standard mode, nrof copies left is reduced by one.transferDone in class ActiveRoutercon - The connection whose transfer was finalizedpublic SprayAndWaitRouter replicate()
MessageRouterreplicate in class MessageRouter