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

Unified Diff: net/udp/udp_socket_win.h

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, 1 month 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: net/udp/udp_socket_win.h
diff --git a/net/udp/udp_socket_win.h b/net/udp/udp_socket_win.h
index bc97d5683655a0fc773d36eadbd535e18c096706..a9b723087567b6b365736531a4e9560c227ea22c 100644
--- a/net/udp/udp_socket_win.h
+++ b/net/udp/udp_socket_win.h
@@ -113,10 +113,10 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) {
// other processes. Should be called before Bind().
void AllowAddressReuse();
- // Sets corresponding flags in |socket_options_| to allow sending
- // and receiving packets to and from broadcast addresses. Should be
- // called before Bind().
- void AllowBroadcast();
+ // Sets corresponding flags in |socket_options_| to allow or disallow
+ // sending and receiving packets to and from broadcast addresses.
+ // Returns a net error code.
+ int SetBroadcast(bool broadcast);
// Join the multicast group.
// |group_address| is the group address to join, could be either
@@ -171,7 +171,9 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) {
enum SocketOptions {
SOCKET_OPTION_REUSE_ADDRESS = 1 << 0,
SOCKET_OPTION_BROADCAST = 1 << 1,
- SOCKET_OPTION_MULTICAST_LOOP = 1 << 2
+ SOCKET_OPTION_MULTICAST_LOOP = 1 << 2,
+ SOCKET_OPTION_RCVBUF_SIZE = 1 << 3,
+ SOCKET_OPTION_SNDBUF_SIZE = 1 << 4
};
class Core;
@@ -203,8 +205,12 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) {
int InternalSendTo(IOBuffer* buf, int buf_len, const IPEndPoint* address);
// Applies |socket_options_| to |socket_|. Should be called before
- // Bind().
+ // DoBind().
int SetSocketOptions();
+ int AllowAddressReuseInternal();
+ int SetBroadcastInternal(bool broadcast);
+ int SetReceiveBufferSizeInternal(int32 size);
+ int SetSendBufferSizeInternal(int32 size);
int DoBind(const IPEndPoint& address);
// Binds to a random port on |address|.
int RandomBind(const IPAddressNumber& address);
@@ -220,6 +226,11 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) {
// options that should be applied to |socket_| before Bind().
int socket_options_;
+ // Locally cacned value of buffer size. These are automatically applied
+ // when SetSocketOptions() is called.
+ int32 rcvbuf_size_;
+ int32 sndbuf_size_;
+
// Multicast interface.
uint32 multicast_interface_;

Powered by Google App Engine
This is Rietveld 408576698