Skip to content

Commit

Permalink
Merge pull request #4 from hollie/fix_xpl_issue_#3
Browse files Browse the repository at this point in the history
Reverted a commit that broke the xPL listening socket on some platforms
  • Loading branch information
hollie committed Nov 6, 2012
2 parents 7ad64f2 + 24da854 commit 9a3c4a1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/xPL_Items.pm
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Once it is running, objects get variables including these:
'set_time' => 1285555578,
'm_timerHeartBeat' => bless( {}, 'Timer' ),
'm_timeoutHeartBeat' => 0,
So, you would write this to print temperature:
print_log $oregon_intemp->state
Expand Down Expand Up @@ -107,10 +107,15 @@ sub startup {
$xpl_send = new Socket_Item( undef, undef, 'xpl_send' );

# Find and use the first open port
# The socket code will select a free local port if given 0
my $port_listen;
&open_port( 0, 'listen', 'xpl_listen', 1, 1 );
$port_listen = $::Socket_Ports{'xpl_listen'}{port};
for my $p (49352 .. 65535) {
$port_listen = $p;
last if &open_port( $port_listen, 'listen', 'xpl_listen', 1, 1);
}
# The socket code will select a free local port if given 0
# not working on ubuntu 12.04
#&open_port( 0, 'listen', 'xpl_listen', 1, 1 );
#$port_listen = $::Socket_Ports{'xpl_listen'}{port};
$xpl_listen = new Socket_Item( undef, undef, 'xpl_listen' );

# initialize the hub (listen) port
Expand Down Expand Up @@ -1015,7 +1020,7 @@ sub tie_value_convertor {
sub device_monitor {
my ( $self, $monitor_info ) = @_;
if ($monitor_info) {
my ($key,$value) = $monitor_info =~ /(\S+)\s*[:=]\s*(.+)/;
my ($key,$value) = $monitor_info =~ /(\S+)\s*[:=]\s*(.+)/;
if ( !( $value or $value =~ /^0/ ) ) {
$value = ($key) ? $key : $monitor_info;
$key = 'device';
Expand Down Expand Up @@ -1358,4 +1363,4 @@ sub new {

}

1;
1;

0 comments on commit 9a3c4a1

Please sign in to comment.