win: remove some unused code

This code was missed in the cleanup done in #971, or just otherwise is
not used on libuv master.

PR-URL: https://github.com/libuv/libuv/pull/2327
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Jameson Nash 2019-06-10 18:37:17 -04:00
parent 988091dada
commit 7c845fb25f
5 changed files with 11 additions and 64 deletions

View File

@ -303,7 +303,8 @@ typedef struct {
LPFN_ACCEPTEX func_acceptex;
#define uv_tcp_connection_fields \
uv_buf_t read_buffer; \
uv_tcp_accept_t* dummy1; /* Mirror of union field, keep as NULL */ \
unsigned int dummy2; /* Mirror of union field, keep as 0 */ \
LPFN_CONNECTEX func_connectex;
#define UV_TCP_PRIVATE_FIELDS \
@ -319,7 +320,6 @@ typedef struct {
unsigned int reqs_pending; \
int activecnt; \
uv_req_t recv_req; \
uv_buf_t recv_buffer; \
struct sockaddr_storage recv_from; \
int recv_from_len; \
uv_udp_recv_cb recv_cb; \
@ -334,11 +334,9 @@ typedef struct {
#define uv_pipe_connection_fields \
uv_timer_t* eof_timer; \
uv_write_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \
DWORD ipc_remote_pid; \
union { \
struct { \
uint32_t payload_remaining; \
uint64_t dummy; /* TODO: retained for ABI compat; remove this in v2.x. */ \
} ipc_data_frame; \
void* ipc_xfer_queue[2]; \
int ipc_xfer_queue_length; \

View File

@ -76,7 +76,7 @@ enum {
UV_HANDLE_WRITABLE = 0x00008000,
UV_HANDLE_READ_PENDING = 0x00010000,
UV_HANDLE_SYNC_BYPASS_IOCP = 0x00020000,
UV_HANDLE_ZERO_READ = 0x00040000,
/*UV_HANDLE_FLAG_UNUSED = 0x00040000,*/
UV_HANDLE_EMULATE_IOCP = 0x00080000,
UV_HANDLE_BLOCKING_WRITES = 0x00100000,
UV_HANDLE_CANCELLATION_PENDING = 0x00200000,

View File

@ -472,7 +472,6 @@ static void uv_tcp_queue_read(uv_loop_t* loop, uv_tcp_t* handle) {
req = &handle->read_req;
memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped));
handle->flags |= UV_HANDLE_ZERO_READ;
buf.base = "";
buf.len = 0;
@ -900,12 +899,10 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
if (!REQ_SUCCESS(req)) {
/* An error occurred doing the read. */
if ((handle->flags & UV_HANDLE_READING) ||
!(handle->flags & UV_HANDLE_ZERO_READ)) {
if ((handle->flags & UV_HANDLE_READING) != 0) {
handle->flags &= ~UV_HANDLE_READING;
DECREASE_ACTIVE_COUNT(loop, handle);
buf = (handle->flags & UV_HANDLE_ZERO_READ) ?
uv_buf_init(NULL, 0) : handle->tcp.conn.read_buffer;
buf = uv_buf_init(NULL, 0);
err = GET_REQ_SOCK_ERROR(req);
@ -920,32 +917,6 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
&buf);
}
} else {
if (!(handle->flags & UV_HANDLE_ZERO_READ)) {
/* The read was done with a non-zero buffer length. */
if (req->u.io.overlapped.InternalHigh > 0) {
/* Successful read */
handle->read_cb((uv_stream_t*)handle,
req->u.io.overlapped.InternalHigh,
&handle->tcp.conn.read_buffer);
/* Read again only if bytes == buf.len */
if (req->u.io.overlapped.InternalHigh < handle->tcp.conn.read_buffer.len) {
goto done;
}
} else {
/* Connection closed */
if (handle->flags & UV_HANDLE_READING) {
handle->flags &= ~UV_HANDLE_READING;
DECREASE_ACTIVE_COUNT(loop, handle);
}
handle->flags &= ~UV_HANDLE_READABLE;
buf.base = 0;
buf.len = 0;
handle->read_cb((uv_stream_t*)handle, UV_EOF, &handle->tcp.conn.read_buffer);
goto done;
}
}
/* Do nonblocking reads until the buffer is empty */
count = 32;
while ((handle->flags & UV_HANDLE_READING) && (count-- > 0)) {
@ -1004,7 +975,6 @@ void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
}
}
done:
/* Post another read if still reading and not closing. */
if ((handle->flags & UV_HANDLE_READING) &&
!(handle->flags & UV_HANDLE_READ_PENDING)) {

View File

@ -34,8 +34,6 @@
*/
const unsigned int uv_active_udp_streams_threshold = 0;
/* A zero-size buffer for use by uv_udp_read */
static char uv_zero_[] = "";
int uv_udp_getpeername(const uv_udp_t* handle,
struct sockaddr* name,
int* namelen) {
@ -283,7 +281,6 @@ static void uv_udp_queue_recv(uv_loop_t* loop, uv_udp_t* handle) {
req = &handle->recv_req;
memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped));
handle->flags |= UV_HANDLE_ZERO_READ;
buf.base = "";
buf.len = 0;
flags = MSG_PEEK;
@ -408,7 +405,6 @@ static int uv__send(uv_udp_send_t* req,
void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle,
uv_req_t* req) {
uv_buf_t buf;
int partial;
assert(handle->type == UV_UDP);
@ -420,35 +416,22 @@ void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle,
/* Not a real error, it just indicates that the received packet was
* bigger than the receive buffer. */
} else if (err == WSAECONNRESET || err == WSAENETRESET) {
/* A previous sendto operation failed; ignore this error. If zero-reading
* we need to call WSARecv/WSARecvFrom _without_ the. MSG_PEEK flag to
* clear out the error queue. For nonzero reads, immediately queue a new
* receive. */
if (!(handle->flags & UV_HANDLE_ZERO_READ)) {
goto done;
}
/* A previous sendto operation failed; ignore this error.
* We need to call WSARecv/WSARecvFrom _without_ the MSG_PEEK flag to
* clear out the error queue. */
} else {
/* A real error occurred. Report the error to the user only if we're
* currently reading. */
if (handle->flags & UV_HANDLE_READING) {
uv_udp_recv_stop(handle);
buf = (handle->flags & UV_HANDLE_ZERO_READ) ?
uv_buf_init(NULL, 0) : handle->recv_buffer;
buf = uv_buf_init(NULL, 0);
handle->recv_cb(handle, uv_translate_sys_error(err), &buf, NULL, 0);
}
goto done;
}
}
if (!(handle->flags & UV_HANDLE_ZERO_READ)) {
/* Successful read */
partial = !REQ_SUCCESS(req);
handle->recv_cb(handle,
req->u.io.overlapped.InternalHigh,
&handle->recv_buffer,
(const struct sockaddr*) &handle->recv_from,
partial ? UV_UDP_PARTIAL : 0);
} else if (handle->flags & UV_HANDLE_READING) {
if (handle->flags & UV_HANDLE_READING) {
DWORD bytes, err, flags;
struct sockaddr_storage from;
int from_len;

View File

@ -33,9 +33,6 @@ static int completed_pingers = 0;
#define NUM_PINGS 1000
#endif
/* 64 bytes is enough for a pinger */
#define BUFSIZE 10240
static char PING[] = "PING\n";
static int pinger_on_connect_count;
@ -49,7 +46,6 @@ typedef struct {
uv_pipe_t pipe;
} stream;
uv_connect_t connect_req;
char read_buffer[BUFSIZE];
} pinger_t;