Skip to content
Permalink
Browse files

Pass the local IP address that the client has connected to on to Conn…

…ection
  • Loading branch information
mstorsjo committed Aug 11, 2010
1 parent 9d91a9a commit a494abcc05280575cdf5d5315de6437b9b52e205
Showing with 11 additions and 0 deletions.
  1. +6 −0 lib/RTSP/Server/Connection.pm
  2. +5 −0 lib/RTSP/Server/Listener.pm
@@ -27,6 +27,12 @@ has 'client_port' => (
required => 1,
);

has 'local_address' => (
is => 'ro',
isa => 'Str',
required => 1,
);

has 'handle' => (
is => 'rw',
accessor => 'h',
@@ -8,6 +8,7 @@ use AnyEvent::Socket;

use RTSP::Server::Source::Connection;
use RTSP::Server::Client::Connection;
use Socket;

has 'listen_address' => (
is => 'rw',
@@ -72,11 +73,15 @@ sub listen {

$self->info("$conn_class connection from $rhost:$rport");

my ($local_port, $local_addr) = sockaddr_in(getsockname($fh));
$local_addr = inet_ntoa($local_addr);

# create object to track client
my $conn = "RTSP::Server::${conn_class}::Connection"->new(
id => $self->next_connection_id,
client_address => $rhost,
client_port => $rport,
local_address => $local_addr,
server => $self->server,
);

0 comments on commit a494abc

Please sign in to comment.