Bug 6620 Ensure autoflush is set on output filehandles
stdout is by default buffered and a flush is only guaranteed on CR Sip responses are not CR terminated so we need to ensure autoflush is switched on so that the filehandle is flushed after a print Otherwise this can manifest as self checks running slow or failing due to timeout (although in the log we see the response) Signed-off-by: Ulrich Kleiber <ulrich.kleiber@bsz-bw.de> Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
parent
47aee699af
commit
f9ccfae400
1 changed files with 4 additions and 1 deletions
|
@ -12,6 +12,7 @@ use Exporter;
|
||||||
use Sys::Syslog qw(syslog);
|
use Sys::Syslog qw(syslog);
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
use Socket qw(:crlf);
|
use Socket qw(:crlf);
|
||||||
|
use IO::Handle;
|
||||||
|
|
||||||
use Sip::Constants qw(SIP_DATETIME);
|
use Sip::Constants qw(SIP_DATETIME);
|
||||||
use Sip::Checksum qw(checksum);
|
use Sip::Checksum qw(checksum);
|
||||||
|
@ -230,9 +231,11 @@ sub write_msg {
|
||||||
|
|
||||||
|
|
||||||
if ($file) {
|
if ($file) {
|
||||||
|
$file->autoflush(1);
|
||||||
print $file "$msg\r";
|
print $file "$msg\r";
|
||||||
} else {
|
} else {
|
||||||
print "$msg\r";
|
STDOUT->autoflush(1);
|
||||||
|
print $msg, "\r";
|
||||||
syslog("LOG_INFO", "OUTPUT MSG: '$msg'");
|
syslog("LOG_INFO", "OUTPUT MSG: '$msg'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue