Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Unified Diff: media/cast/net/udp_transport.cc

Issue 721273002: Remove timing limitation to set Broadcast, ReceiveBuffer, and SendBuffer options from UDPSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/cast/net/udp_transport.cc
diff --git a/media/cast/net/udp_transport.cc b/media/cast/net/udp_transport.cc
index 43ef86284085a59d1f3e8bf5080b69bea2f15de5..71495fc4c16fe54f36607a45c2ac1ca2cba0bae6 100644
--- a/media/cast/net/udp_transport.cc
+++ b/media/cast/net/udp_transport.cc
@@ -72,13 +72,17 @@ void UdpTransport::StartReceiving(
udp_socket_->AllowAddressReuse();
udp_socket_->SetMulticastLoopbackMode(true);
if (!IsEmpty(local_addr_)) {
- if (udp_socket_->Bind(local_addr_) < 0) {
+ if (udp_socket_->Open(local_addr_.GetFamily()) < 0 ||
+ udp_socket_->Bind(local_addr_) < 0) {
+ udp_socket_->Close();
status_callback_.Run(TRANSPORT_SOCKET_ERROR);
LOG(ERROR) << "Failed to bind local address.";
return;
}
} else if (!IsEmpty(remote_addr_)) {
- if (udp_socket_->Connect(remote_addr_) < 0) {
+ if (udp_socket_->Open(remote_addr_.GetFamily()) < 0 ||
+ udp_socket_->Connect(remote_addr_) < 0) {
+ udp_socket_->Close();
status_callback_.Run(TRANSPORT_SOCKET_ERROR);
LOG(ERROR) << "Failed to connect to remote address.";
return;

Powered by Google App Engine
This is Rietveld 408576698