-
-
Save mgood7123/1ec93a07f36d88612a1233c1e1c503d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// send data | |
while (connection->out.head - connection->out.tail > 0) { | |
ring_buffer_get_iov(&connection->out, iov, &count); | |
if (len == SOCKET_ERROR) | |
return -1; | |
struct wl_ring_buffer * buffer = &connection->out; | |
do { | |
len = send(connection->fd, ring_buffer_size(buffer), sizeof(size_t), 0); | |
} while (len == SOCKET_ERROR && WSAGetLastError() == WSAEINTR); | |
do { | |
len = send(connection->fd, connection->out.data, ring_buffer_size(buffer), 0); | |
} while (len == SOCKET_ERROR && WSAGetLastError() == WSAEINTR); | |
connection->out.tail += len; | |
} | |
connection->want_flush = 0; | |
return connection->out.head - tail; | |
// ... | |
// recieve data | |
size_t ring_buf_len; | |
do { | |
len = recv(connection->fd, &ring_buf_len, sizeof(size_t), 0); | |
} while (len == SOCKET_ERROR && WSAGetLastError() == WSAEINTR); | |
RING_BUFFER_TYPE * ring_buf_data = zalloc(ring_buf_len); | |
do { | |
len = recv(connection->fd, ring_buf_data, ring_buf_len, 0); | |
} while (len == SOCKET_ERROR && WSAGetLastError() == WSAEINTR); | |
if (len <= 0) | |
return len; | |
connection->in.head += len; | |
return wl_connection_pending_input(connection); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment