When using libdrizzle in nonblocking mode, there's no way for the caller to know whether to wait for readability or writability on the socket when libdrizzle returns DRIZZLE_RETURN_IO_WAIT.
(Often it'll be waiting for readability, but it needs to wait for writability if you're sending a long query or bound parameter, or using SSL, or doing nonblocking connect.)
I can think of three obvious ways to extend the libdrizzle api to fix this:
- add a function drizzle_fd_waiting_for() (but with a better name) that returns POLLIN, POLLOUT, etc
- change drizzle_fd() to return both the fd and the current flags
- split DRIZZLE_RETURN_IO_WAIT into two return codes, DRIZZLE_RETURN_IO_READ and DRIZZLE_RETURN_IO_WRITE
When using libdrizzle in nonblocking mode, there's no way for the caller to know whether to wait for readability or writability on the socket when libdrizzle returns DRIZZLE_ RETURN_ IO_WAIT.
(Often it'll be waiting for readability, but it needs to wait for writability if you're sending a long query or bound parameter, or using SSL, or doing nonblocking connect.)
I can think of three obvious ways to extend the libdrizzle api to fix this:
- add a function drizzle_ fd_waiting_ for() (but with a better name) that returns POLLIN, POLLOUT, etc RETURN_ IO_WAIT into two return codes, DRIZZLE_ RETURN_ IO_READ and DRIZZLE_ RETURN_ IO_WRITE
- change drizzle_fd() to return both the fd and the current flags
- split DRIZZLE_