From 077ef9aca823046996514e5eaeb5fbffe1606019 Mon Sep 17 00:00:00 2001 From: Tr1xt4n Date: Fri, 31 Mar 2023 11:27:12 +0200 Subject: [PATCH] fix packet --- src/main/java/fr/ntr/scheduler/Scheduler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/ntr/scheduler/Scheduler.java b/src/main/java/fr/ntr/scheduler/Scheduler.java index b2dc953..d19015f 100644 --- a/src/main/java/fr/ntr/scheduler/Scheduler.java +++ b/src/main/java/fr/ntr/scheduler/Scheduler.java @@ -15,7 +15,7 @@ public abstract class Scheduler { protected void allocateRessource(User userMax, ResourceBlock[][] frame, int ts, int sp, int ticks) { if (userMax != null && !userMax.getPacketsToSend().isEmpty()) { - Packets p = userMax.getPacketsToSend().get(0); + Packets p = userMax.getPacketsToSend().get(userMax.getPacketsToSend().size()-1); if(p.getBitsNumberRemaining() > 0){ p.decreaseBitsNumberRemaining((int) userMax.getBandwidthTable()[ts][sp]); } else { @@ -31,4 +31,4 @@ public abstract class Scheduler { frame[ts][sp].setBandwidth(userMax.getBandwidthTable()[ts][sp]); } } -} +} \ No newline at end of file