| Index: net/udp/udp_socket_win.h
|
| diff --git a/net/udp/udp_socket_win.h b/net/udp/udp_socket_win.h
|
| index 6f0ec2ccbf142222b9fb41a3348fe1a30fa011db..6d60cdffdef7e39ce66b118237a4a47f748debcc 100644
|
| --- a/net/udp/udp_socket_win.h
|
| +++ b/net/udp/udp_socket_win.h
|
| @@ -174,6 +174,10 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) {
|
| // Resets the thread to be used for thread-safety checks.
|
| void DetachFromThread();
|
|
|
| + // This class by default uses overlapped IO. Call this method before Open()
|
| + // to switch to non-blocking IO.
|
| + void UseNonBlockingIO();
|
| +
|
| private:
|
| enum SocketOptions {
|
| SOCKET_OPTION_MULTICAST_LOOP = 1 << 0
|
| @@ -183,8 +187,14 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) {
|
|
|
| void DoReadCallback(int rv);
|
| void DoWriteCallback(int rv);
|
| - void DidCompleteRead();
|
| - void DidCompleteWrite();
|
| +
|
| + // Version for using overlapped IO.
|
| + void DidCompleteReadOverlapped();
|
| + void DidCompleteWriteOverlapped();
|
| +
|
| + // Version for using non-blocking IO.
|
| + void DidCompleteReadNonBlocking();
|
| + void DidCompleteWriteNonBlocking();
|
|
|
| // Handles stats and logging. |result| is the number of bytes transferred, on
|
| // success, or the net error code on failure. LogRead retrieves the address
|
| @@ -201,8 +211,22 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) {
|
| const CompletionCallback& callback);
|
|
|
| int InternalConnect(const IPEndPoint& address);
|
| - int InternalRecvFrom(IOBuffer* buf, int buf_len, IPEndPoint* address);
|
| - int InternalSendTo(IOBuffer* buf, int buf_len, const IPEndPoint* address);
|
| +
|
| + // Version for using overlapped IO.
|
| + int InternalRecvFromOverlapped(IOBuffer* buf,
|
| + int buf_len,
|
| + IPEndPoint* address);
|
| + int InternalSendToOverlapped(IOBuffer* buf,
|
| + int buf_len,
|
| + const IPEndPoint* address);
|
| +
|
| + // Version for using non-blocking IO.
|
| + int InternalRecvFromNonBlocking(IOBuffer* buf,
|
| + int buf_len,
|
| + IPEndPoint* address);
|
| + int InternalSendToNonBlocking(IOBuffer* buf,
|
| + int buf_len,
|
| + const IPEndPoint* address);
|
|
|
| // Applies |socket_options_| to |socket_|. Should be called before
|
| // Bind().
|
| @@ -247,6 +271,9 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) {
|
| // they are not destroyed while the OS still references them.
|
| scoped_refptr<Core> core_;
|
|
|
| + bool non_blocking_reads_initialized_;
|
| + bool non_blocking_writes_initialized_;
|
| +
|
| IPEndPoint* recv_from_address_;
|
|
|
| // Cached copy of the current address we're sending to, if any. Used for
|
| @@ -265,6 +292,9 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) {
|
| HANDLE qos_handle_;
|
| QOS_FLOWID qos_flow_id_;
|
|
|
| + // True if overlapp IO is used.
|
| + bool use_overlapped_io_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(UDPSocketWin);
|
| };
|
|
|
|
|