Use src/lib/w32/w32sockets.c for client
Move client's w32_connect() to w32sockets.c. Replace w32_recv() and w32_send() by read() and write(). Replace w32_close() by w32_close_function. Replace call of WSAStartup() in w32_sysdep_init() by w32_socket_init(). Remove the identical copies of fd_is_socket(), w32_set_winsock_errno(), w32_socket().
This commit is contained in:
parent
1153d9c995
commit
4d40a27542
12 changed files with 49 additions and 200 deletions
|
@ -39,14 +39,13 @@
|
|||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef _WIN32
|
||||
#include <sys/select.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#include <process.h>
|
||||
#include <io.h>
|
||||
#include "w32types.h"
|
||||
#include <sys/socket.h>
|
||||
#else
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include "linebuf.h"
|
||||
#include "misc.h"
|
||||
#include "proto.h"
|
||||
|
@ -204,7 +203,7 @@ w32_select(int nfds, fd_set *rdfd, fd_set *wrfd, fd_set *errfd, struct timeval*
|
|||
default:
|
||||
assert(0);
|
||||
}
|
||||
sock = W32_FD_TO_SOCKET(sockfd);
|
||||
sock = w32_fd2socket(sockfd);
|
||||
|
||||
assert(wrfd->fd_count == 0
|
||||
|| (wrfd->fd_count == 1 && wrfd->fd_array[0] == (SOCKET)sockfd));
|
||||
|
@ -295,8 +294,6 @@ w32_ring_from_file_or_bounce_buf(struct ring *r, int fd)
|
|||
return res;
|
||||
}
|
||||
#define ring_from_file w32_ring_from_file_or_bounce_buf
|
||||
#define read(sock, buffer, buf_size) \
|
||||
w32_recv((sock), (buffer), (buf_size), 0)
|
||||
#define select(nfds, rd, wr, error, time) \
|
||||
w32_select((nfds), (rd), (wr), (error), (time))
|
||||
#define sigemptyset(mask) ((void)0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue