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); |
21 |
|
20 |
use Koha::Caches; |
22 |
use Koha::Caches; |
21 |
|
23 |
|
22 |
use Koha::Logger; |
24 |
use Koha::Logger; |
Lines 86-94
__PACKAGE__ ->run(@parms);
Link Here
|
86 |
# Child |
88 |
# Child |
87 |
# |
89 |
# |
88 |
|
90 |
|
89 |
my $activeSIPServer; |
|
|
90 |
my $activeLogger; |
91 |
|
92 |
# process_request is the callback used by Net::Server to handle |
91 |
# process_request is the callback used by Net::Server to handle |
93 |
# an incoming connection request. |
92 |
# an incoming connection request. |
94 |
|
93 |
|
Lines 104-110
sub process_request {
Link Here
|
104 |
Koha::Caches->flush_L1_caches(); |
103 |
Koha::Caches->flush_L1_caches(); |
105 |
|
104 |
|
106 |
$self->{account} = undef; # Clear out the account from the last request, it may be different |
105 |
$self->{account} = undef; # Clear out the account from the last request, it may be different |
107 |
$self->{logger} = _set_logger( Koha::Logger->get( { interface => 'sip' } ) ); |
106 |
$self->{logger} = set_logger( Koha::Logger->get( { interface => 'sip' } ) ); |
108 |
|
107 |
|
109 |
# Flush previous MDCs to prevent accidentally leaking incorrect MDC-entries |
108 |
# Flush previous MDCs to prevent accidentally leaking incorrect MDC-entries |
110 |
Log::Log4perl::MDC->put( "accountid", undef ); |
109 |
Log::Log4perl::MDC->put( "accountid", undef ); |
Lines 175-181
sub raw_transport {
Link Here
|
175 |
} |
174 |
} |
176 |
alarm 0; |
175 |
alarm 0; |
177 |
|
176 |
|
178 |
$self->{logger} = _set_logger( |
177 |
$self->{logger} = set_logger( |
179 |
Koha::Logger->get( |
178 |
Koha::Logger->get( |
180 |
{ |
179 |
{ |
181 |
interface => 'sip', |
180 |
interface => 'sip', |
Lines 425-482
sub get_timeout {
Link Here
|
425 |
} |
424 |
} |
426 |
} |
425 |
} |
427 |
|
426 |
|
428 |
=head2 get_SIPServer |
|
|
429 |
|
430 |
my $sipServer = C4::SIP::SIPServer::get_SIPServer() |
431 |
|
432 |
@RETURNS C4::SIP::SIPServer, the current server's child-process used to handle this SIP-transaction |
433 |
|
434 |
=cut |
435 |
|
436 |
sub get_SIPServer { |
437 |
unless($activeSIPServer) { |
438 |
my @cc = caller(1); |
439 |
die "$cc[3]() asks for \$activeSIPServer, but he is not defined yet"; |
440 |
} |
441 |
return $activeSIPServer; |
442 |
} |
443 |
|
444 |
sub _set_SIPServer { |
445 |
my ($sipServer) = @_; |
446 |
unless (blessed($sipServer) && $sipServer->isa('C4::SIP::SIPServer')) { |
447 |
my @cc = caller(0); |
448 |
die "$cc[3]():> \$sipServer '$sipServer' is not a C4::SIP::SIPServer-object"; |
449 |
} |
450 |
$activeSIPServer = $sipServer; |
451 |
return $activeSIPServer; |
452 |
} |
453 |
|
454 |
=head2 get_logger |
455 |
|
456 |
my $logger = C4::SIP::SIPServer::get_logger() |
457 |
|
458 |
@RETURNS Koha::Logger, the logger used to log this SIP-transaction |
459 |
|
460 |
=cut |
461 |
|
462 |
sub get_logger { |
463 |
unless($activeLogger) { |
464 |
my @cc = caller(1); |
465 |
die "$cc[3]() asks for \$activeLogger, but he is not defined yet"; |
466 |
} |
467 |
return $activeLogger; |
468 |
} |
469 |
|
470 |
sub _set_logger { |
471 |
my ($logger) = @_; |
472 |
unless (blessed($logger) && $logger->isa('Koha::Logger')) { |
473 |
my @cc = caller(0); |
474 |
die "$cc[3]():> \$logger '$logger' is not a Koha::Logger-object"; |
475 |
} |
476 |
$activeLogger = $logger; |
477 |
return $activeLogger; |
478 |
} |
479 |
|
480 |
1; |
427 |
1; |
481 |
|
428 |
|
482 |
__END__ |
429 |
__END__ |