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_; |