Revision: 34619
http://sourceforge.net/p/opalvoip/code/34619
Author: rjongbloed
Date: 2016-02-14 14:04:19 +0000 (Sun, 14 Feb 2016)
Log Message:
-----------
Allow for delay in getting remote address when NAT media mode is triggered during a transfer.
Modified Paths:
--------------
opal/branches/v3_16/src/opal/mediasession.cxx
Modified: opal/branches/v3_16/src/opal/mediasession.cxx
===================================================================
--- opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-14 13:52:24 UTC (rev 34618)
+++ opal/branches/v3_16/src/opal/mediasession.cxx 2016-02-14 14:04:19 UTC (rev 34619)
@@ -1154,29 +1154,32 @@
if (PAssertNULL(socket) == NULL)
return false;
- bool writeSuccess = dest != NULL ? socket->WriteTo(data, length, *dest) : socket->Write(data, length);
- // This insanity prevents a totally unbelievable CPU issue when under heavy load.
- if (writeSuccess)
- return true;
+ PIPSocketAddressAndPort sendAddr;
+ if (dest != NULL)
+ sendAddr = *dest;
+ else
+ socket->GetSendAddress(sendAddr);
+ if (dest->IsValid()) {
+ if (socket->WriteTo(data, length, sendAddr))
+ return true;
+ }
+ else {
+ PTRACE(4, "UDP write has no destination address.");
+ /* The following makes not having destination address yet be processed the
+ same as if the remote is not yet listening on the port (ICMP errors) so it
+ will keep trying for a while, then give up and close the media transport. */
+ socket->SetErrorValues(PChannel::Unavailable, EINVAL, PChannel::LastWriteError);
+ }
+
if (socket->GetErrorCode(PChannel::LastWriteError) == PChannel::Unavailable && m_subchannels[subchannel].HandleUnavailableError())
return true;
-#if PTRACING
- if (PTrace::CanTrace(1)) {
- ostream & trace = PTRACE_BEGIN(1);
- trace << *this << "error writing to ";
- if (dest != NULL)
- trace << *dest;
- else
- trace << socket->GetSendAddress();
- trace << " (" << length << " bytes)"
- " on " << subchannel << " subchannel"
- " (" << socket->GetErrorNumber(PChannel::LastWriteError) << "):"
- " " << socket->GetErrorText(PChannel::LastWriteError)
- << PTrace::End;
- }
-#endif
+ PTRACE(1, *this << "error writing to " << sendAddr
+ << " (" << length << " bytes)"
+ " on " << subchannel << " subchannel"
+ " (" << socket->GetErrorNumber(PChannel::LastWriteError) << "):"
+ " " << socket->GetErrorText(PChannel::LastWriteError));
return false;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|