MCPcopy Create free account
hub / github.com/akeranen/the-one / getMessagesForConnected

Method getMessagesForConnected

routing/ActiveRouter.java:350–368  ·  view source on GitHub ↗

Returns a list of message-connections tuples of the messages whose recipient is some host that we're connected to at the moment. @return a list of message-connections tuples

()

Source from the content-addressed store, hash-verified

348 * @return a list of message-connections tuples
349 */
350 protected List<Tuple<Message, Connection>> getMessagesForConnected() {
351 if (getNrofMessages() == 0 || getConnections().size() == 0) {
352 /* no messages -> empty list */
353 return new ArrayList<Tuple<Message, Connection>>(0);
354 }
355
356 List<Tuple<Message, Connection>> forTuples =
357 new ArrayList<Tuple<Message, Connection>>();
358 for (Message m : getMessageCollection()) {
359 for (Connection con : getConnections()) {
360 DTNHost to = con.getOtherNode(getHost());
361 if (m.getTo() == to) {
362 forTuples.add(new Tuple<Message, Connection>(m,con));
363 }
364 }
365 }
366
367 return forTuples;
368 }
369
370 /**
371 * Tries to send messages for the connections that are mentioned

Callers 1

Calls 7

getConnectionsMethod · 0.95
getOtherNodeMethod · 0.80
addMethod · 0.80
getNrofMessagesMethod · 0.45
getMessageCollectionMethod · 0.45
getHostMethod · 0.45
getToMethod · 0.45

Tested by

no test coverage detected