Ensuring that UDP TURN servers are always used as STUN servers.
This was already working in most cases, but not for some corner cases: * If the PORTALLOCATOR_ENABLE_SHARED_SOCKET flag is not set * If both a STUN server and TURN server are configured I added unit tests for these cases, and centralized the code that gets STUN server addresses in order to fix these and any related issues. BUG=webrtc:4215 Review URL: https://codereview.webrtc.org/1215713003 Cr-Commit-Position: refs/heads/master@{#9596}
This commit is contained in:
@ -81,10 +81,18 @@ int BufferedReadAdapter::Recv(void *pv, size_t cb) {
|
||||
// FIX: If cb == 0, we won't generate another read event
|
||||
|
||||
int res = AsyncSocketAdapter::Recv(pv, cb);
|
||||
if (res < 0)
|
||||
return res;
|
||||
if (res >= 0) {
|
||||
// Read from socket and possibly buffer; return combined length
|
||||
return res + static_cast<int>(read);
|
||||
}
|
||||
|
||||
return res + static_cast<int>(read);
|
||||
if (read > 0) {
|
||||
// Failed to read from socket, but still read something from buffer
|
||||
return static_cast<int>(read);
|
||||
}
|
||||
|
||||
// Didn't read anything; return error from socket
|
||||
return res;
|
||||
}
|
||||
|
||||
void BufferedReadAdapter::BufferInput(bool on) {
|
||||
|
||||
Reference in New Issue
Block a user