Migrating to threaded rlm_perl

Energ ponch at ponch.ru
Mon Jun 20 13:39:48 CEST 2011


Hi everyone!

Please, help me with understanding of concept how to rewrite my perl module
to work with threaded perl.

Now it looks like this:

my %options_pools = (create=>1, exclusive=>0, mode=>0644, destroy=>1);
tie my %pooldb, 'IPC::Shareable', $pools_glue, { %options_pools } or die
"Tie failed: $!\n";
...
code to fullfill shared segment
...

sub post_auth {
...
$RAD_REPLY{'Framed-IP-Address'} =
"$pooldb{$rpool}{$RAD_REQUEST{'Calling-Station-Id'}}
...
%up= fetch_url("$https_host","$https_xml","$RAD_REQUEST{'User-Name'}");

}

sub fetch_url {
...
using Net::HTTP i retrieve some additional stuff from billing.
...
}

While non-threaded perl it works as expected. But threading breaks creation
of Shared memory (cuz it want to do it for every thread). 
I also wonder, do i need to post &fetch_url inside CLONE sub or not.
So, the main question: is there any part of code in rlm, that suppose to run
only once ( create shared memory in my situation) or how to correctly solve
problem with IPC within the confines of freeradius.

Thx!

--
View this message in context: http://freeradius.1045715.n5.nabble.com/Migrating-to-threaded-rlm-perl-tp4506040p4506040.html
Sent from the FreeRadius - User mailing list archive at Nabble.com.



More information about the Freeradius-Users mailing list