@@ -750,14 +750,15 @@ Server.Swarm = Swarm
750750function makeUdpPacket ( params ) {
751751 let packet
752752 switch ( params . action ) {
753- case common . ACTIONS . CONNECT :
753+ case common . ACTIONS . CONNECT : {
754754 packet = Buffer . concat ( [
755755 common . toUInt32 ( common . ACTIONS . CONNECT ) ,
756756 common . toUInt32 ( params . transactionId ) ,
757757 params . connectionId
758758 ] )
759759 break
760- case common . ACTIONS . ANNOUNCE :
760+ }
761+ case common . ACTIONS . ANNOUNCE : {
761762 packet = Buffer . concat ( [
762763 common . toUInt32 ( common . ACTIONS . ANNOUNCE ) ,
763764 common . toUInt32 ( params . transactionId ) ,
@@ -767,7 +768,8 @@ function makeUdpPacket (params) {
767768 params . peers
768769 ] )
769770 break
770- case common . ACTIONS . SCRAPE :
771+ }
772+ case common . ACTIONS . SCRAPE : {
771773 const scrapeResponse = [
772774 common . toUInt32 ( common . ACTIONS . SCRAPE ) ,
773775 common . toUInt32 ( params . transactionId )
@@ -782,13 +784,15 @@ function makeUdpPacket (params) {
782784 }
783785 packet = Buffer . concat ( scrapeResponse )
784786 break
785- case common . ACTIONS . ERROR :
787+ }
788+ case common . ACTIONS . ERROR : {
786789 packet = Buffer . concat ( [
787790 common . toUInt32 ( common . ACTIONS . ERROR ) ,
788791 common . toUInt32 ( params . transactionId || 0 ) ,
789792 Buffer . from ( String ( params [ 'failure reason' ] ) )
790793 ] )
791794 break
795+ }
792796 default :
793797 throw new Error ( `Action not implemented: ${ params . action } ` )
794798 }
0 commit comments