Lines 17-22
use C4::SIP::Sip::Constants qw(:all);
Link Here
|
17 |
use C4::SIP::Sip::Configuration; |
17 |
use C4::SIP::Sip::Configuration; |
18 |
use C4::SIP::Sip::Checksum qw(checksum verify_cksum); |
18 |
use C4::SIP::Sip::Checksum qw(checksum verify_cksum); |
19 |
use C4::SIP::Sip::MsgType qw( handle login_core ); |
19 |
use C4::SIP::Sip::MsgType qw( handle login_core ); |
|
|
20 |
use C4::SIP::Logger qw(set_logger); |
20 |
|
21 |
|
21 |
use Koha::Logger; |
22 |
use Koha::Logger; |
22 |
use C4::SIP::Trapper; |
23 |
use C4::SIP::Trapper; |
Lines 85-93
__PACKAGE__ ->run(@parms);
Link Here
|
85 |
# Child |
86 |
# Child |
86 |
# |
87 |
# |
87 |
|
88 |
|
88 |
my $activeSIPServer; |
|
|
89 |
my $activeLogger; |
90 |
|
91 |
# process_request is the callback used by Net::Server to handle |
89 |
# process_request is the callback used by Net::Server to handle |
92 |
# an incoming connection request. |
90 |
# an incoming connection request. |
93 |
|
91 |
|
Lines 100-106
sub process_request {
Link Here
|
100 |
$self->{config} = $config; |
98 |
$self->{config} = $config; |
101 |
|
99 |
|
102 |
$self->{account} = undef; # Clear out the account from the last request, it may be different |
100 |
$self->{account} = undef; # Clear out the account from the last request, it may be different |
103 |
$self->{logger} = _set_logger( Koha::Logger->get( { interface => 'sip' } ) ); |
101 |
$self->{logger} = set_logger( Koha::Logger->get( { interface => 'sip' } ) ); |
104 |
|
102 |
|
105 |
# Flush previous MDCs to prevent accidentally leaking incorrect MDC-entries |
103 |
# Flush previous MDCs to prevent accidentally leaking incorrect MDC-entries |
106 |
Log::Log4perl::MDC->put( "accountid", undef ); |
104 |
Log::Log4perl::MDC->put( "accountid", undef ); |
Lines 171-177
sub raw_transport {
Link Here
|
171 |
} |
169 |
} |
172 |
alarm 0; |
170 |
alarm 0; |
173 |
|
171 |
|
174 |
$self->{logger} = _set_logger( |
172 |
$self->{logger} = set_logger( |
175 |
Koha::Logger->get( |
173 |
Koha::Logger->get( |
176 |
{ |
174 |
{ |
177 |
interface => 'sip', |
175 |
interface => 'sip', |
Lines 421-478
sub get_timeout {
Link Here
|
421 |
} |
419 |
} |
422 |
} |
420 |
} |
423 |
|
421 |
|
424 |
=head2 get_SIPServer |
|
|
425 |
|
426 |
my $sipServer = C4::SIP::SIPServer::get_SIPServer() |
427 |
|
428 |
@RETURNS C4::SIP::SIPServer, the current server's child-process used to handle this SIP-transaction |
429 |
|
430 |
=cut |
431 |
|
432 |
sub get_SIPServer { |
433 |
unless($activeSIPServer) { |
434 |
my @cc = caller(1); |
435 |
die "$cc[3]() asks for \$activeSIPServer, but he is not defined yet"; |
436 |
} |
437 |
return $activeSIPServer; |
438 |
} |
439 |
|
440 |
sub _set_SIPServer { |
441 |
my ($sipServer) = @_; |
442 |
unless (blessed($sipServer) && $sipServer->isa('C4::SIP::SIPServer')) { |
443 |
my @cc = caller(0); |
444 |
die "$cc[3]():> \$sipServer '$sipServer' is not a C4::SIP::SIPServer-object"; |
445 |
} |
446 |
$activeSIPServer = $sipServer; |
447 |
return $activeSIPServer; |
448 |
} |
449 |
|
450 |
=head2 get_logger |
451 |
|
452 |
my $logger = C4::SIP::SIPServer::get_logger() |
453 |
|
454 |
@RETURNS Koha::Logger, the logger used to log this SIP-transaction |
455 |
|
456 |
=cut |
457 |
|
458 |
sub get_logger { |
459 |
unless($activeLogger) { |
460 |
my @cc = caller(1); |
461 |
die "$cc[3]() asks for \$activeLogger, but he is not defined yet"; |
462 |
} |
463 |
return $activeLogger; |
464 |
} |
465 |
|
466 |
sub _set_logger { |
467 |
my ($logger) = @_; |
468 |
unless (blessed($logger) && $logger->isa('Koha::Logger')) { |
469 |
my @cc = caller(0); |
470 |
die "$cc[3]():> \$logger '$logger' is not a Koha::Logger-object"; |
471 |
} |
472 |
$activeLogger = $logger; |
473 |
return $activeLogger; |
474 |
} |
475 |
|
476 |
1; |
422 |
1; |
477 |
|
423 |
|
478 |
__END__ |
424 |
__END__ |