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

Unified Diff: mojo/services/network/udp_socket_impl.h

Issue 863253002: Update from https://crrev.com/312600 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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: mojo/services/network/udp_socket_impl.h
diff --git a/mojo/services/network/udp_socket_impl.h b/mojo/services/network/udp_socket_impl.h
index 8028d1c2a6eece19f79a071af516d0ce099fba10..f5d3f8225ce02224304317484be63dd6ccb1409c 100644
--- a/mojo/services/network/udp_socket_impl.h
+++ b/mojo/services/network/udp_socket_impl.h
@@ -12,7 +12,7 @@
#include "mojo/public/cpp/bindings/interface_impl.h"
#include "mojo/services/network/public/interfaces/udp_socket.mojom.h"
#include "net/base/ip_endpoint.h"
-#include "net/udp/udp_server_socket.h"
+#include "net/udp/udp_socket.h"
namespace net {
class IOBuffer;
@@ -57,6 +57,12 @@ class UDPSocketImpl : public InterfaceImpl<UDPSocket> {
const Callback<void(NetworkErrorPtr)>& callback) override;
private:
+ enum State {
+ NOT_BOUND_OR_CONNECTED,
+ BOUND,
+ CONNECTED
+ };
+
struct PendingSendRequest {
PendingSendRequest();
~PendingSendRequest();
@@ -75,13 +81,19 @@ class UDPSocketImpl : public InterfaceImpl<UDPSocket> {
void OnSendToCompleted(const Callback<void(NetworkErrorPtr)>& callback,
int net_result);
- net::UDPServerSocket socket_;
+ bool IsBoundOrConnected() const {
+ return state_ == BOUND || state_ == CONNECTED;
+ }
+
+ net::UDPSocket socket_;
+
+ State state_;
- bool bound_;
+ bool allow_address_reuse_;
- // Non-NULL when there is a pending RecvFrom operation on |socket_|.
+ // Non-null when there is a pending RecvFrom operation on |socket_|.
scoped_refptr<net::IOBuffer> recvfrom_buffer_;
- // Non-NULL when there is a pending SendTo operation on |socket_|.
+ // Non-null when there is a pending SendTo operation on |socket_|.
scoped_refptr<net::IOBufferWithSize> sendto_buffer_;
net::IPEndPoint recvfrom_address_;

Powered by Google App Engine
This is Rietveld 408576698