No way to know whether to wait for readability or writability
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Drizzle Client & Protocol Library |
New
|
Undecided
|
Unassigned |
Bug Description
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_
(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 (bug #1096032), or doing nonblocking connect (bug #1211567).)
I can think of three obvious ways to extend the libdrizzle api to fix this:
- add a function drizzle_
- change drizzle_fd() to return both the fd and the current flags
- split DRIZZLE_
I am pasting my answer to the related question here as well as I think it helps/is relevant:
In the old version of libdrizzle you had to just call the query_function function again after telling drizzle about the events that happened using
/** set_event_ watch_fn( ). set_revents( drizzle_ st *con, short revents);
* Set events that are ready for a connection. This is used with the external
* event callbacks. See drizzle_
*
* @param[in] con Connection structure previously initialized with
* drizzle_create(), drizzle_clone(), or related functions.
* @param[in] revents Bitfield of poll() events that were detected.
* @return Standard drizzle return value.
*/
DRIZZLE_API
drizzle_return_t drizzle_
However this references drizzle_ set_event_ watch_fn which was for reasons unknown to me, removed in revesion 56 /bugs.launchpad .net/libdrizzle /+bug/1220467
The function was used by drizzle to tell an external poll mechanism what events it is interested in and when to tell it (using set_revents). Without it problems like described here arise: https:/
I think you can simply wait for everything and just call the function again. Worst case is that you'll get a IO_WAIT return value again. I think ;)
I am going to try exactly this now in any case. Can let you know how it'll go.