43
43
if ((flags & VIO_BUFFERED_READ) &&
44
44
!(vio->read_buffer= (char*)my_malloc(VIO_READ_BUFFER_SIZE, MYF(MY_WME))))
45
45
flags&= ~VIO_BUFFERED_READ;
47
if (type == VIO_TYPE_NAMEDPIPE)
49
vio->viodelete =vio_delete;
50
vio->vioerrno =vio_errno;
51
vio->read =vio_read_pipe;
52
vio->write =vio_write_pipe;
53
vio->fastsend =vio_fastsend;
54
vio->viokeepalive =vio_keepalive;
55
vio->should_retry =vio_should_retry;
56
vio->was_interrupted=vio_was_interrupted;
57
vio->vioclose =vio_close_pipe;
58
vio->peer_addr =vio_peer_addr;
59
vio->vioblocking =vio_blocking;
60
vio->is_blocking =vio_is_blocking;
61
vio->timeout =vio_ignore_timeout;
63
else /* default is VIO_TYPE_TCPIP */
66
if (type == VIO_TYPE_SHARED_MEMORY)
68
vio->viodelete =vio_delete;
69
vio->vioerrno =vio_errno;
70
vio->read =vio_read_shared_memory;
71
vio->write =vio_write_shared_memory;
72
vio->fastsend =vio_fastsend;
73
vio->viokeepalive =vio_keepalive;
74
vio->should_retry =vio_should_retry;
75
vio->was_interrupted=vio_was_interrupted;
76
vio->vioclose =vio_close_shared_memory;
77
vio->peer_addr =vio_peer_addr;
78
vio->vioblocking =vio_blocking;
79
vio->is_blocking =vio_is_blocking;
80
vio->timeout =vio_ignore_timeout;
85
47
vio->viodelete =vio_delete;
86
48
vio->vioerrno =vio_errno;
142
103
(void) ioctl(sd,FIOSNBIO,0);
143
104
vio->fcntl_mode &= ~O_NONBLOCK;
145
#else /* !defined(__WIN__) */
147
/* set to blocking mode by default */
149
r = ioctlsocket(sd,FIONBIO,(void*) &arg);
150
vio->fcntl_mode &= ~O_NONBLOCK;
160
Vio *vio_new_win32pipe(HANDLE hPipe)
163
DBUG_ENTER("vio_new_handle");
164
if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME))))
166
vio_init(vio, VIO_TYPE_NAMEDPIPE, 0, hPipe, VIO_LOCALHOST);
167
strmov(vio->desc, "named pipe");
173
Vio *vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, HANDLE handle_map,
174
HANDLE event_server_wrote, HANDLE event_server_read,
175
HANDLE event_client_wrote, HANDLE event_client_read,
176
HANDLE event_conn_closed)
179
DBUG_ENTER("vio_new_win32shared_memory");
180
if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME))))
182
vio_init(vio, VIO_TYPE_SHARED_MEMORY, 0, 0, VIO_LOCALHOST);
183
vio->handle_file_map= handle_file_map;
184
vio->handle_map= handle_map;
185
vio->event_server_wrote= event_server_wrote;
186
vio->event_server_read= event_server_read;
187
vio->event_client_wrote= event_client_wrote;
188
vio->event_client_read= event_client_read;
189
vio->event_conn_closed= event_conn_closed;
190
vio->shared_memory_remain= 0;
191
vio->shared_memory_pos= handle_map;
193
strmov(vio->desc, "shared memory");
201
111
void vio_delete(Vio* vio)