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

Unified Diff: net/udp/udp_socket_libevent.h

Issue 10739002: Added broadcasting feature to UDP server sockets. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed Win code. Created 8 years, 5 months 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_libevent.h
diff --git a/net/udp/udp_socket_libevent.h b/net/udp/udp_socket_libevent.h
index 3242e18f12cc112048e5db89b2fcec1fee389669..076ebe153dd282137a7b50407e9fe400aba5b3d4 100644
--- a/net/udp/udp_socket_libevent.h
+++ b/net/udp/udp_socket_libevent.h
@@ -103,9 +103,18 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe {
const BoundNetLog& NetLog() const { return net_log_; }
+ void AllowAddressReuse();
+
+ void AllowBroadcast();
wtc 2012/07/12 23:49:47 NOTE: all the changes I suggest for this file also
ygorshenin1 2012/07/16 10:29:44 Done.
+
private:
static const int kInvalidSocket = -1;
+ enum SocketOptions {
+ SOCKET_OPTION_REUSE_ADDRESS = 1 << 0,
+ SOCKET_OPTION_BROADCAST = 1 << 1
+ };
+
class ReadWatcher : public MessageLoopForIO::Watcher {
public:
explicit ReadWatcher(UDPSocketLibevent* socket) : socket_(socket) {}
@@ -172,10 +181,12 @@ class NET_EXPORT UDPSocketLibevent : public base::NonThreadSafe {
int InternalRecvFrom(IOBuffer* buf, int buf_len, IPEndPoint* address);
int InternalSendTo(IOBuffer* buf, int buf_len, const IPEndPoint* address);
+ int SetSocketOptions();
int DoBind(const IPEndPoint& address);
int RandomBind(const IPEndPoint& address);
int socket_;
+ int socket_options_;
wtc 2012/07/12 23:49:47 Nit: document these members.
ygorshenin1 2012/07/16 10:29:44 Done.
// How to do source port binding, used only when UDPSocket is part of
// UDPClientSocket, since UDPServerSocket provides Bind.

Powered by Google App Engine
This is Rietveld 408576698