Skip to content

Commit 5f27002

Browse files
authored
Apply packetLoss also to up interface (#69)
If should work (tested running `tc` manually) as already done with the `down` interface.
1 parent 8bf7380 commit 5f27002

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

lib/tc.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async function setLimits(up, down, halfWayRTT, packetLoss, indexFace) {
118118
await sudo.apply(this, parameters);
119119
}
120120
if (up) {
121-
await sudo(
121+
const params = [
122122
'tc',
123123
'qdisc',
124124
'add',
@@ -132,7 +132,13 @@ async function setLimits(up, down, halfWayRTT, packetLoss, indexFace) {
132132
`${halfWayRTT}ms`,
133133
'rate',
134134
`${up}kbit`
135-
);
135+
];
136+
137+
if (packetLoss) {
138+
params.push('loss', `${packetLoss}%`);
139+
}
140+
141+
await sudo.apply(this, params);
136142
}
137143

138144
if (!up && !down && halfWayRTT > 0) {

0 commit comments

Comments
 (0)