From d6070a0c9454a20d2c2dc7638044f629f82e2a06 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Wed, 10 Nov 2010 13:09:01 +0000 Subject: [PATCH] interfere with ongoing transfer even if transmission fails --- .../cooja/radiomediums/DirectedGraphMedium.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/cooja/java/se/sics/cooja/radiomediums/DirectedGraphMedium.java b/tools/cooja/java/se/sics/cooja/radiomediums/DirectedGraphMedium.java index 44f57a282..ed7b22c1c 100644 --- a/tools/cooja/java/se/sics/cooja/radiomediums/DirectedGraphMedium.java +++ b/tools/cooja/java/se/sics/cooja/radiomediums/DirectedGraphMedium.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: DirectedGraphMedium.java,v 1.6 2010/10/12 10:29:43 fros4943 Exp $ + * $Id: DirectedGraphMedium.java,v 1.7 2010/11/10 13:09:01 fros4943 Exp $ */ package se.sics.cooja.radiomediums; @@ -352,6 +352,21 @@ public class DirectedGraphMedium extends AbstractRadioMedium { if (dest.ratio < 1.0 && random.nextDouble() > dest.ratio) { /*logger.info(source + ": Fail, randomly");*/ /* TODO Interfere now? */ + newConn.addInterfered(dest.radio); + + dest.radio.interfereAnyReception(); + RadioConnection otherConnection = null; + for (RadioConnection conn : getActiveConnections()) { + for (Radio dstRadio : conn.getDestinations()) { + if (dstRadio == dest.radio) { + otherConnection = conn; + break; + } + } + } + if (otherConnection != null) { + otherConnection.addInterfered(dest.radio); + } continue; }