Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Pass the local IP address that the client has connected to on to Conn…
- Loading branch information
Showing
with
11 additions
and
0 deletions.
-
+6
−0
lib/RTSP/Server/Connection.pm
-
+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, |
|
|
); |
|
|
|
|
|
|