r22171 - in /trunk/libnet-sip-perl: ./ debian/ lib/Net/ lib/Net/SIP/ lib/Net/SIP/Dispatcher/ lib/Net/SIP/Endpoint/ lib/Net/SIP/Simple/ samples/ t/
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Thu Jun 26 06:38:28 UTC 2008
Author: dmn
Date: Thu Jun 26 06:38:28 2008
New Revision: 22171
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=22171
Log:
New upstream release
Added:
trunk/libnet-sip-perl/t/11_invite_timeout.t
- copied unchanged from r22170, branches/upstream/libnet-sip-perl/current/t/11_invite_timeout.t
Modified:
trunk/libnet-sip-perl/Changes
trunk/libnet-sip-perl/MANIFEST
trunk/libnet-sip-perl/META.yml
trunk/libnet-sip-perl/debian/changelog
trunk/libnet-sip-perl/lib/Net/SIP.pm
trunk/libnet-sip-perl/lib/Net/SIP/Dispatcher/Eventloop.pm
trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm
trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod
trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm
trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod
trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm
trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm
trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod
trunk/libnet-sip-perl/samples/invite_and_send.pl
trunk/libnet-sip-perl/t/09_fdleak.t
trunk/libnet-sip-perl/t/10_fdleak.t
Modified: trunk/libnet-sip-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/Changes?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/Changes (original)
+++ trunk/libnet-sip-perl/Changes Thu Jun 26 06:38:28 2008
@@ -1,4 +1,18 @@
Revision history for Net::SIP
+
+0.45_3
+ - support for canceling a call after some time of ringing based on
+ input from http://rt.cpan.org/Ticket/Display.html?id=34576
+ see Net::SIP::Simple::Call documentation for sub reinvite, parameters
+ ring_time, cb_noanswer. See also method cancel in this package
+ feature gets used in samples/invite_and_send.pl too
+ - fix for t/*_fdleak for platforms, which use 2 fd for tempfiles (see
+ http://rt.cpan.org/Ticket/Display.html?id=35485). Now it allocates a
+ new fd simply by dup()ing STDOUT
+ - fix in Net::SIP::Dispatcher::Eventloop in case the select returned
+ because of EINTR
+ - fixes in handling response in Net::SIP::Endpoint::Context for the case,
+ that multiple requests shared the same tid (e.g. INVITE,CANCEL)
0.45
- Net::SIP::Packet::sdp_body - content type is case insensitive,
Modified: trunk/libnet-sip-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/MANIFEST?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/MANIFEST (original)
+++ trunk/libnet-sip-perl/MANIFEST Thu Jun 26 06:38:28 2008
@@ -64,6 +64,7 @@
t/08_register_with_auth.t
t/09_fdleak.t
t/10_fdleak.t
+t/11_invite_timeout.t
t/testlib.pl
samples/README
samples/invite_and_recv.pl
Modified: trunk/libnet-sip-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/META.yml?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/META.yml (original)
+++ trunk/libnet-sip-perl/META.yml Thu Jun 26 06:38:28 2008
@@ -1,13 +1,11 @@
---- #YAML:1.0
-name: Net-SIP
-version: 0.45
-abstract: ~
-license: ~
-author: ~
-generated_by: ExtUtils::MakeMaker version 6.42
-distribution_type: module
-requires:
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Net-SIP
+version: 0.45_3
+version_from: lib/Net/SIP.pm
+installdirs: site
+requires:
Net::DNS: 0.56
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.30_01
Modified: trunk/libnet-sip-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/debian/changelog?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/debian/changelog (original)
+++ trunk/libnet-sip-perl/debian/changelog Thu Jun 26 06:38:28 2008
@@ -1,15 +1,12 @@
-libnet-sip-perl (0.45-1) UNRELEASED; urgency=low
-
- [ Rene Mayorga ]
- NOTE: Builds fine with perl 5.10, just waiting for new developer release
- be released
-
- * New upstream release
+libnet-sip-perl (0.45.3-1) UNRELEASED; urgency=low
[ MartÃn Ferrari ]
* Updating my email address
- -- MartÃn Ferrari <tincho at debian.org> Fri, 13 Jun 2008 00:04:48 +0000
+ [ Damyan Ivanov ]
+ * New upstream release
+
+ -- Damyan Ivanov <dmn at debian.org> Thu, 26 Jun 2008 09:35:59 +0300
libnet-sip-perl (0.44.1-1) unstable; urgency=low
Modified: trunk/libnet-sip-perl/lib/Net/SIP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP.pm?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP.pm Thu Jun 26 06:38:28 2008
@@ -4,7 +4,7 @@
require 5.008;
package Net::SIP;
-our $VERSION = '0.45';
+our $VERSION = '0.45_3';
# this includes nearly everything else
use Net::SIP::Simple ();
Modified: trunk/libnet-sip-perl/lib/Net/SIP/Dispatcher/Eventloop.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Dispatcher/Eventloop.pm?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Dispatcher/Eventloop.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Dispatcher/Eventloop.pm Thu Jun 26 06:38:28 2008
@@ -14,6 +14,7 @@
use List::Util qw(first);
use Net::SIP::Util 'invoke_callback';
use Net::SIP::Debug;
+use Errno 'EINTR';
###########################################################################
# creates new event loop
@@ -164,7 +165,10 @@
my $rin = '';
map { vec( $rin,fileno($_->[0]),1 ) = 1 } @to_read;
DEBUG( 100, "handles=".join( " ",map { fileno($_->[0]) } @to_read ));
- die $! if select( my $rout = $rin,undef,undef,$to ) < 0;
+ select( my $rout = $rin,undef,undef,$to ) < 0 and do {
+ next if $! == EINTR;
+ die $!
+ };
# returned from select
$looptime = $self->{now} = gettimeofday();
DEBUG( 100, "can_read=".join( " ",map { $_ } grep { $fds->[$_] && vec($rout,$_,1) } (0..$#$fds)));
Modified: trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pm Thu Jun 26 06:38:28 2008
@@ -174,6 +174,26 @@
}
############################################################################
+# Cancel last pending INVITE request
+# Args: ($self,$ctx,$request,$cb)
+# $ctx: context for call
+# $request: request to cancel, will only cancel it, if request is
+# outstanding in context, will cancel latest INVITE if not given
+# $cb: callback for generated CANCEL request
+# Returns: number of requests canceled (e.g 0 if no outstanding INVITE)
+############################################################################
+sub cancel_invite {
+ my Net::SIP::Endpoint $self = shift;
+ my Net::SIP::Endpoint::Context $ctx = shift;
+ my ($request,$callback) = @_;
+ my ($pkt) = $ctx->find_outstanding_requests(
+ $request ? ( request => $request ) : ( method => 'INVITE' )
+ ) or return;
+ $self->new_request( $pkt->create_cancel, $ctx, $callback );
+ return 1;
+}
+
+############################################################################
# internal callback used for delivery
# will be called from dispatcher if the request was definitly successfully
# delivered (tcp only) or an error occurred
@@ -319,7 +339,7 @@
# deliver a response packet
# Args: ($self,$ctx,$response,$leg,$addr)
# $ctx : Net::SIP::Endpoint::Context which generated response
-# $response: Net::SIP::Respone packet
+# $response: Net::SIP::Response packet
# $leg : leg to send out response, eg where the request came in
# $addr : where to send respone (ip:port), eg where the request came from
# Returns: NONE
Modified: trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint.pod Thu Jun 26 06:38:28 2008
@@ -190,6 +190,15 @@
request which can be then used for further requests in the same
call.
+=item cancel_invite ( CTX, REQUEST, CALLBACK )
+
+Cancel the given request within the given context (e.g send CANCEL request).
+If no REQUEST is given it will cancel the most recent INVITE. Returns the
+number of requests canceled, e.g. 0 or 1.
+
+CALLBACK will be used as the callback for the CANCEL request it sends using
+B<new_request>.
+
=item close_context ( CTX )
Delete L<Net::SIP::Endpoint::Context> object CTX from the list
Modified: trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pm Thu Jun 26 06:38:28 2008
@@ -84,8 +84,12 @@
return $self
}
-sub DESTROY {
- DEBUG( 100,"DESTROY context $_[0] callid=$_[0]->{callid}" ) if $_[0];
+# destroying of fields in perl5.8 cleanup can cause strange errors, where
+# it complains, that it cannot coerce array into hash. So use this function
+# on your own risks and rename it to DETSTROY if you want to have debugging
+# info
+sub _DESTROY {
+ DEBUG( 100,"DESTROY context $_[0] callid=$_[0]->{callid}" );
}
############################################################################
@@ -109,6 +113,30 @@
my $peer = $self->{incoming} ? $self->{from} : $self->{to};
my ($data) = sip_hdrval2parts( from => $peer ); # strip parameters like tag etc
return $data;
+}
+
+############################################################################
+# return list of outstanding requests matching filter, if no filter is given
+# returns all requests
+# Args: ($self,%filter)
+# %filter
+# method => name: filter for requests with given method
+# request => packet: filter for packet, e.g. finds if packet is outstanding
+# Returns: @requests
+# returns all matching requests (Net::SIP::Request objects), newest
+# requests first
+############################################################################
+sub find_outstanding_requests {
+ my Net::SIP::Endpoint::Context $self = shift;
+ my %filter = @_;
+ my @trans = @{$self->{_transactions}} or return;
+ if ( my $pkt = $filter{request} ) {
+ @trans = grep { $pkt == $_->{request} } @trans or return;
+ }
+ if ( my $method = $filter{method} ) {
+ @trans = grep { $method eq $_->{request}->method } @trans or return;
+ }
+ return map { $_->{request} } @trans;
}
############################################################################
@@ -182,7 +210,6 @@
return $request;
}
-
############################################################################
# set callback for context
# Args: ($self,$cb)
@@ -243,10 +270,11 @@
# if response does not terminates transaction one need to add
# it again
my $tid = $response->tid;
+ my $method = $response->method;
my $trans = $self->{_transactions};
my (@ntrans,$tr);
foreach my $t (@$trans) {
- if ( $t->{tid} eq $tid ) {
+ if ( !$tr and $t->{tid} eq $tid and $method eq $t->{request}->method) {
$tr = $t;
} else {
push @ntrans,$t
@@ -268,18 +296,6 @@
DEBUG( 10,"response came in through the wrong leg" );
return;
};
-
-
- # check if it's a response to the current method in the
- # transaction (ACK,CANCEL,INVITE share the same transaction,
- # but are different methods)
-
- my $method = $tr->{request}->method;
- $response->cseq =~m{^\d+\s+(\w+)};
- if ($method ne $1 ) {
- DEBUG( 10,"got response to method $1 but current method is $method. DROP" );
- return;
- }
my $cb = $tr->{callback};
my @arg = ($endpoint,$self);
Modified: trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Endpoint/Context.pod Thu Jun 26 06:38:28 2008
@@ -111,6 +111,17 @@
It returns the created request object.
+=item find_outstanding_requests ( %FILTER )
+
+Returns list of outstanding requests (e.g INVITE w/o reply) for this
+context. Returns a list of outstanding request (L<Net::SIP::Request>
+objects) with the most recent requests first.
+
+FILTER might be used to restrict the search. With key B<request> a
+L<Net::SIP::Request> object is expected and it will restrict the search to
+this object (e.g. it will return the object if it is outstanding). With key
+B<method> a method can be specified and only requests with this method will
+be returned.
=item set_callback ( CALLBACK )
Modified: trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Simple.pm Thu Jun 26 06:38:28 2008
@@ -382,7 +382,9 @@
# if regex only from matching regex gets accepted
# if sub and sub returns 1 call gets accepted, if sub returns 0 it gets rejected
# cb_create: optional callback called on creation of newly created
-# Net::SIP::Simple::Call
+# Net::SIP::Simple::Call. If returns false the call will be closed.
+# If returns a callback (e.g some ref) it will be used instead of
+# Net::SIP::Simple::Call to handle the data
# cb_established: callback called after receiving ACK
# cb_cleanup: called on destroy of call object
# for all other args see Net::SIP::Simple::Call....
@@ -422,10 +424,13 @@
# notify caller about new call
if ( my $cbc = $args->{cb_create} ) {
- if ( ! invoke_callback( $cbc, $call, $request,$leg,$from ) ) {
+ my $cbx =invoke_callback( $cbc, $call, $request,$leg,$from );
+ if ( ! $cbx ) {
DEBUG( 1, "call from '$ctx->{from}' rejected in cb_create" );
$self->{endpoint}->close_context( $ctx );
return;
+ } elsif ( ref($cbx) ) {
+ $cb = $cbx
}
}
if ( my $ccb = $args->{cb_cleanup} ) {
Modified: trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pm Thu Jun 26 06:38:28 2008
@@ -224,6 +224,7 @@
invoke_callback( $param->{init_media},$self,$param );
};
+
my $stopvar = 0;
$param->{cb_final} ||= \$stopvar;
$cb = [ $cb,$self ];
@@ -232,14 +233,87 @@
$ctx, $cb, $sdp,
$param->{sip_header} ? %{ $param->{sip_header} } : ()
);
+
if ( $param->{cb_final} == \$stopvar ) {
- # wait until final response
- $self->loop( \$stopvar );
+
+ # This callback will be called on timeout or response to cancel which
+ # got send after ring_time was over
+ my $noanswercb;
+ if ( $param->{ring_time} ) {
+ $noanswercb = sub {
+ my Net::SIP::Simple::Call $self = shift || return;
+ my ($endpoint,$ctx,$errno,$code,$packet,$leg,$from,$ack) = @_;
+
+ $stopvar = 'NOANSWER' ;
+ my $param = $self->{param};
+ invoke_callback( $param->{cb_noanswer}, 'NOANSWER',$self,
+ errno => $errno,code => $code,packet => $packet );
+
+ if ( $code =~ m{^2\d\d} ) {
+ DEBUG(10,"got response of %s|%s to CANCEL",$code,$packet->msg );
+ invoke_callback( $param->{cb_final},'NOANSWER',$self,code => $code );
+ }
+ };
+ $noanswercb = [ $noanswercb,$self ];
+ weaken( $noanswercb->[1] );
+
+ # wait until final response
+ $self->loop( $param->{ring_time}, \$stopvar );
+
+ unless ($stopvar) { # timed out
+ $self->{endpoint}->cancel_invite( $self->{ctx},undef, $noanswercb );
+ $self->loop( \$stopvar );
+ }
+ } else {
+ # wait until final response
+ $self->loop( \$stopvar );
+ }
+
$param->{cb_final} = undef;
}
return $self->{ctx};
}
+
+###########################################################################
+# cancel call
+# Args: ($self,%args)
+# %args:
+# cb_final: callback when CANCEL was delivered. If not given send_cancel
+# callback on Call object will be used
+# Returns: true if call could be canceled
+# Comment: cb_final gets triggered if the reply for the CANCEL is received
+# or waiting for the reply timed out
+###########################################################################
+sub cancel {
+ my Net::SIP::Simple::Call $self = shift;
+ my %args = @_;
+
+ my $cb = delete $args{cb_final};
+ %args = ( %{ $self->{param} }, %args );
+ $cb ||= $args{send_cancel};
+
+ my $cancel_cb = [
+ sub {
+ my Net::SIP::Simple::Call $self = shift || return;
+ my ($cb,$args,$endpoint,$ctx,$error,$code) = @_;
+ # we don't care about the cause of this callback
+ # it might be a successful or failed reply packet or no reply
+ # packet at all (timeout) - the call is considered closed
+ # in any case except for 1xx responses
+ if ( $code && $code =~m{^1\d\d} ) {
+ DEBUG( 10,"got prelimary response for CANCEL" );
+ return;
+ }
+ invoke_callback( $cb,$args );
+ $self->cleanup;
+ },
+ $self,$cb,\%args
+ ];
+ weaken( $cancel_cb->[1] );
+
+ return $self->{endpoint}->cancel_invite( $self->{ctx}, undef, $cancel_cb );
+}
###########################################################################
# end call
Modified: trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod (original)
+++ trunk/libnet-sip-perl/lib/Net/SIP/Simple/Call.pod Thu Jun 26 06:38:28 2008
@@ -203,7 +203,11 @@
successful.
If no B<cb_final> callback was given it will wait in the event loop until a final
-response was received.
+response was received. Only in this case it will also use the param
+B<ring_time> which specifies the time it will wait for a final response. If
+no final response came in within this time it will send a CANCEL request for
+this call to close it. In this case a callback specified with B<cb_noanswer>
+will be called after the CANCEL was delivered (or delivery failed).
Returns the connection context as L<Net::SIP::Endpoint::Context> object.
@@ -211,6 +215,16 @@
L<Net::SIP::Simple::Call> object to create the first SDP session. Changes on the
SDP session will be done by calling this method on the L<Net::SIP::Simple::Call>
object C<$self>.
+
+=item cancel ( %ARGS )
+
+Closes a pending call by sending a CANCEL request.
+Returns true if call was pending and could be canceled.
+
+If %ARGS contains B<cb_final> it will be used as a callback and invoked once it gets
+the response for the CANCEL (which might be a response packet or a timeout).
+The rest of %ARGS will be merged with the connection parameter and given as an argument
+to the B<cb_final> callback (as hash reference).
=item bye ( %ARGS )
Modified: trunk/libnet-sip-perl/samples/invite_and_send.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/samples/invite_and_send.pl?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/samples/invite_and_send.pl (original)
+++ trunk/libnet-sip-perl/samples/invite_and_send.pl Thu Jun 26 06:38:28 2008
@@ -33,6 +33,7 @@
-R|--registrar host[:port] register at given address
-S|--send filename send content of file, can be given multiple times
-L|--leg ip[:port] use given local ip[:port] for outgoing leg
+ -T|--timeout T timeout and cancel invite after T seconds, default 30
--username name username for authorization
--password pass password for authorization
@@ -50,6 +51,7 @@
# Get options
###################################################
+my $ring_time = 30;
my ($proxy, at files,$registrar,$username,$password,$local_leg);
my ($debug,$hangup);
GetOptions(
@@ -59,6 +61,7 @@
'R|registrar=s' => \$registrar,
'S|send=s' => \@files,
'L|leg=s' => \$local_leg,
+ 'T|timeout=s' => \$ring_time,
'username=s' =>\$username,
'password=s' =>\$password,
) || usage( "bad option" );
@@ -142,17 +145,22 @@
# invite peer, send first file
my $peer_hangup; # did peer hang up?
+my $no_answer; # or didn't it even answer?
my $rtp_done; # was sending file completed?
my $call = $ua->invite( $to,
# echo back, use -1 instead of 0 for not echoing back
init_media => $ua->rtp( 'send_recv', $files[0] ),
cb_rtp_done => \$rtp_done,
recv_bye => \$peer_hangup,
+ cb_noanswer => \$no_answer,
+ ring_time => $ring_time,
) || die "invite failed: ".$ua->error;
die "invite failed(call): ".$call->error if $call->error;
-DEBUG( "sending first file $files[0]" );
-$ua->loop( \$rtp_done,\$peer_hangup );
+DEBUG( "Call established (maybe), sending first file $files[0]" );
+$ua->loop( \$rtp_done,\$peer_hangup,\$no_answer );
+
+die "Ooops, no answer." if $no_answer;
# mainloop until other party hangs up or we are done
# send one file after the other using re-invites
Modified: trunk/libnet-sip-perl/t/09_fdleak.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/t/09_fdleak.t?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/t/09_fdleak.t (original)
+++ trunk/libnet-sip-perl/t/09_fdleak.t Thu Jun 26 06:38:28 2008
@@ -74,11 +74,9 @@
-my $id;
-use File::Temp 'tempfile';
sub newfd {
- $id++;
- my $tfd = tempfile( "t_$id-XXXXXXXXXX" );
- return $tfd;
+ # dup STDOUT to create new fd
+ open( my $fd,'>&STDOUT' );
+ return $fd;
}
Modified: trunk/libnet-sip-perl/t/10_fdleak.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libnet-sip-perl/t/10_fdleak.t?rev=22171&op=diff
==============================================================================
--- trunk/libnet-sip-perl/t/10_fdleak.t (original)
+++ trunk/libnet-sip-perl/t/10_fdleak.t Thu Jun 26 06:38:28 2008
@@ -88,12 +88,9 @@
}
-
-my $id;
-use File::Temp 'tempfile';
sub newfd {
- $id++;
- my $tfd = tempfile( "t_$id-XXXXXXXXXX" );
- return $tfd;
+ # dup STDOUT to create new fd
+ open( my $fd,'>&STDOUT' );
+ return $fd;
}
More information about the Pkg-perl-cvs-commits
mailing list