Skip to content

Commit e71e015

Browse files
committed
For WOL feature, move call to setsockopt out of the look #402
1 parent 88a6adc commit e71e015

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Libki/Clients.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ sub wakeonlan {
2424
or $c->log()->fatal("ERROR in Socket Creation : $!\n");
2525

2626
if ($socket) {
27+
setsockopt( $socket, SOL_SOCKET, SO_BROADCAST, 1 );
28+
2729
foreach my $mac_address (@mac_addresses) {
2830
$c->log()->debug("Sending magic packet to $mac_address at $host:$port");
2931
$mac_address =~ s/://g;
3032
my $packet = pack( 'C6H*', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, $mac_address x 16 );
3133

32-
setsockopt( $socket, SOL_SOCKET, SO_BROADCAST, 1 );
3334
$success = 0 unless send( $socket, $packet, 0, $sockaddr );
3435
$socket->close;
3536
}

0 commit comments

Comments
 (0)