From: Luke Dashjr Date: Tue, 8 Mar 2011 22:50:35 +0000 (-0600) Subject: Bugfix: FreeSWITCH::Client::sendmsg was returning the first FSES packet it received... X-Git-Tag: v1.2-rc1~171^2~59^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=189d81a1b2913c9ce3a83dbe07a5c05de6a7be7c;p=thirdparty%2Ffreeswitch.git Bugfix: FreeSWITCH::Client::sendmsg was returning the first FSES packet it received, which caused a race condition when an event was in transit; now it waits for Content-Type: command/reply --- diff --git a/scripts/perl/FreeSWITCH/Client.pm b/scripts/perl/FreeSWITCH/Client.pm index 9e97218580..01748a8180 100644 --- a/scripts/perl/FreeSWITCH/Client.pm +++ b/scripts/perl/FreeSWITCH/Client.pm @@ -143,7 +143,13 @@ sub sendmsg($$$) { } $self->output("\n"); - return $self->readhash($to); + for(;;) { + $e = $self->readhash(undef); + last if $e->{socketerror} or $e->{'content-type'} eq 'command/reply'; + push @{$self->{events}}, $e; + } + + return $e; } sub command($$) {