Skip to content

Commit

Permalink
Fix T38Modem hang when sending non-ECM data and the line drops.
Browse files Browse the repository at this point in the history
Problem found at Regions Bank.

This is a rather serious problem where a line drop during a non-ECM send fax
will cause T38Modem to stop receiving data on the pty. The problem was introduced
on 2012-11-09 with commit 728b05 "Added compatibility for OPAL >= 3.10.5".
In this commit the code was changed to use InternalClose() instead of Close() in
in T38ModemMediaStream. The check for isOpen was left in, but Opal has already
turned off isOpen before calling InternalClose. Therefore, the code inside that
if, the call to t38engine->CloseOut() is not run and that causes the backup of
data that causes the hang.

This fix is serious enough to bump the revision to 3.15.3.
  • Loading branch information
PeteDavidson committed Nov 22, 2017
1 parent c070be1 commit a0b23a6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
34 changes: 27 additions & 7 deletions opal/modemstrm.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,16 @@ PBoolean AudioModemMediaStream::Open()

#if (OPAL_PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) >= OPAL_PACK_VERSION(3, 10, 5))
void AudioModemMediaStream::InternalClose()
{
PTRACE(3, "AudioModemMediaStream::Close " << *this);

if (IsSink())
audioEngine->CloseIn(EngineBase::HOWNERIN(this));
else
audioEngine->CloseOut(EngineBase::HOWNEROUT(this));
}
#else
PBoolean AudioModemMediaStream::Close()
#endif
{
if (isOpen) {
PTRACE(3, "AudioModemMediaStream::Close " << *this);
Expand All @@ -128,10 +135,9 @@ PBoolean AudioModemMediaStream::Close()
audioEngine->CloseOut(EngineBase::HOWNEROUT(this));
}

#if (OPAL_PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) < OPAL_PACK_VERSION(3, 10, 5))
return OpalMediaStream::Close();
#endif
}
#endif

PBoolean AudioModemMediaStream::ReadData(BYTE * data, PINDEX size, PINDEX & length)
{
Expand Down Expand Up @@ -199,11 +205,26 @@ PBoolean T38ModemMediaStream::Open()

#if (OPAL_PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) >= OPAL_PACK_VERSION(3, 10, 5))
void T38ModemMediaStream::InternalClose()
{
PTRACE(3, "T38ModemMediaStream::InternalClose " << *this);

if (IsSink()) {
PTRACE(2, "T38ModemMediaStream::Close Send statistics:"
" sequence=" << currentSequenceNumber <<
" lost=" << totallost);

t38engine->CloseIn(EngineBase::HOWNERIN(this));
} else {
PTRACE(2, "T38ModemMediaStream::Close Receive statistics:"
" sequence=" << currentSequenceNumber);

t38engine->CloseOut(EngineBase::HOWNEROUT(this));
}
}
#else
PBoolean T38ModemMediaStream::Close()
#endif
{
if (isOpen) {
if (isOpen == isOpen) {
PTRACE(3, "T38ModemMediaStream::Close " << *this);

if (IsSink()) {
Expand All @@ -220,10 +241,9 @@ PBoolean T38ModemMediaStream::Close()
}
}

#if (OPAL_PACK_VERSION(OPAL_MAJOR, OPAL_MINOR, OPAL_BUILD) < OPAL_PACK_VERSION(3, 10, 5))
return OpalMediaStream::Close();
#endif
}
#endif

void T38ModemMediaStream::OnStartMediaPatch()
{
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 15
#define BUILD_TYPE ReleaseCode
#define BUILD_NUMBER 2
#define BUILD_NUMBER 3

#endif // _T38M_VERSION_H

0 comments on commit a0b23a6

Please sign in to comment.