From 4f2bd68744583ff9ac0023f64f4600288c0cde03 Mon Sep 17 00:00:00 2001 From: "fischman@webrtc.org" Date: Fri, 28 Mar 2014 18:13:34 +0000 Subject: [PATCH] Silence pointless LS_WARNING about port 0 for active-only candidates. R=mallinath@webrtc.org Review URL: https://webrtc-codereview.appspot.com/10899004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5808 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/app/webrtc/webrtcsession.cc | 4 +++- talk/p2p/base/transport.cc | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc index 50221ac992..2d040291a6 100644 --- a/talk/app/webrtc/webrtcsession.cc +++ b/talk/app/webrtc/webrtcsession.cc @@ -1397,7 +1397,9 @@ bool WebRtcSession::UseCandidate( } // TODO(bemasc): If state is Completed, go back to Connected. } else { - LOG(LS_WARNING) << error; + if (!error.empty()) { + LOG(LS_WARNING) << error; + } } return true; } diff --git a/talk/p2p/base/transport.cc b/talk/p2p/base/transport.cc index 0090c078fb..8261f723eb 100644 --- a/talk/p2p/base/transport.cc +++ b/talk/p2p/base/transport.cc @@ -1,6 +1,6 @@ /* * libjingle - * Copyright 2004--2005, Google Inc. + * Copyright 2004, Google Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -405,6 +405,12 @@ bool Transport::VerifyCandidate(const Candidate& cand, std::string* error) { // Disallow all ports below 1024, except for 80 and 443 on public addresses. int port = cand.address().port(); + if (port == 0) { + // Expected for active-only candidates per + // http://tools.ietf.org/html/rfc6544#section-4.5 so no error. + *error = ""; + return false; + } if (port < 1024) { if ((port != 80) && (port != 443)) { *error = "candidate has port below 1024, but not 80 or 443";