Skip to content

Commit 7981124

Browse files
committed
Sort by application layer then packet id instead
1 parent 2e8f0cb commit 7981124

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

controllers/Packet/Index.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,14 @@ public function run(Router &$router) {
3636
// Alphabetically sort the packets for HTML
3737
if ($view instanceof PacketIndexHtmlView && $model->packets) {
3838
usort($model->packets, function($a, $b){
39-
$a1 = $a->getPacketName();
40-
$b1 = $b->getPacketName();
41-
if ($a1 == $b1) return 0;
39+
$a1 = $a->getPacketApplicationLayerId();
40+
$b1 = $b->getPacketApplicationLayerId();
41+
if ($a1 == $b1) {
42+
$a2 = $a->getPacketId();
43+
$b2 = $b->getPacketId();
44+
if ($a2 == $b2) return 0;
45+
return ($a2 < $b2 ? -1 : 1);
46+
}
4247
return ($a1 < $b1 ? -1 : 1);
4348
});
4449
}

0 commit comments

Comments
 (0)