View | Details | Raw Unified | Return to bug 15006
Collapse All | Expand All

(-)a/C4/SIP/SIPServer.pm (-7 / +16 lines)
Lines 124-143 sub process_request { Link Here
124
124
125
sub raw_transport {
125
sub raw_transport {
126
    my $self = shift;
126
    my $self = shift;
127
    my ($input);
128
    my $service = $self->{service};
127
    my $service = $self->{service};
128
    my $strikes = 3;
129
130
    local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; };
131
    my $timeout = $service->{timeout} || 30;
132
    syslog("LOG_DEBUG", "raw_transport: timeout is %d", $timeout);
129
133
130
    while (!$self->{account}) {
134
    while( $strikes && ( !$self->{account} || !$self->{account}->{id} )) {
131
        local $SIG{ALRM} = sub { die "raw_transport Timed Out!\n"; };
135
    # an empty account hash is not good enough..
132
        syslog("LOG_DEBUG", "raw_transport: timeout is %d", $service->{timeout});
136
        alarm $timeout;
133
        $input = read_request();
137
        my $input = read_request();
134
        if (!$input) {
138
        if (!$input) {
135
            # EOF on the socket
139
            # EOF on the socket
136
            syslog("LOG_INFO", "raw_transport: shutting down: EOF during login");
140
            syslog("LOG_INFO", "raw_transport: shutting down: EOF during login");
137
            return;
141
            return;
138
        }
142
        }
139
        $input =~ s/[\r\n]+$//sm; # Strip off trailing line terminator(s)
143
        $input =~ s/[\r\n]+$//sm; # Strip off trailing line terminator(s)
140
        last if C4::SIP::Sip::MsgType::handle($input, $self, LOGIN);
144
        C4::SIP::Sip::MsgType::handle($input, $self, LOGIN);
145
        $strikes--;
146
    }
147
    alarm 0;
148
    if( !$self->{account} || !$self->{account}->{id} ) {
149
        syslog("LOG_ERR", "raw_transport: Login Failed");
150
        die "Login Failure";
141
    }
151
    }
142
152
143
    syslog("LOG_DEBUG", "raw_transport: uname/inst: '%s/%s'",
153
    syslog("LOG_DEBUG", "raw_transport: uname/inst: '%s/%s'",
144
- 

Return to bug 15006