diff options
author | Emil Renner Berthing <esmil@mailme.dk> | 2013-01-31 15:16:03 +0100 |
---|---|---|
committer | Emil Renner Berthing <esmil@mailme.dk> | 2013-01-31 15:57:55 +0100 |
commit | 57493c3b79b0ee0ae6020b06dd981e2362a7a426 (patch) | |
tree | 79811d915032006612d10ef9b7a4985306d5062d | |
parent | e6b1bb5b5d573336721763563a6b75ae3cdc8164 (diff) | |
download | lem-postgres-57493c3b79b0ee0ae6020b06dd981e2362a7a426.tar.gz lem-postgres-57493c3b79b0ee0ae6020b06dd981e2362a7a426.tar.xz lem-postgres-57493c3b79b0ee0ae6020b06dd981e2362a7a426.zip |
don't set w.events directly, always use ev_io_set()
-rw-r--r-- | lem/postgres.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lem/postgres.c b/lem/postgres.c index cfcd683..0523bf5 100644 --- a/lem/postgres.c +++ b/lem/postgres.c @@ -452,7 +452,7 @@ db_exec(lua_State *T) d->T = T; d->w.cb = db_exec_cb; - d->w.events = EV_READ; + ev_io_set(&d->w, PQsocket(d->conn), EV_READ); ev_io_start(LEM_ &d->w); lua_settop(T, 1); @@ -480,7 +480,7 @@ db_prepare(lua_State *T) d->T = T; d->w.cb = db_exec_cb; - d->w.events = EV_READ; + ev_io_set(&d->w, PQsocket(d->conn), EV_READ); ev_io_start(LEM_ &d->w); lua_settop(T, 1); @@ -526,7 +526,7 @@ db_run(lua_State *T) d->T = T; d->w.cb = db_exec_cb; - d->w.events = EV_READ; + ev_io_set(&d->w, PQsocket(d->conn), EV_READ); ev_io_start(LEM_ &d->w); lua_settop(T, 1); @@ -600,7 +600,7 @@ db_put(lua_State *T) d->T = T; d->w.cb = db_put_cb; - d->w.events = EV_WRITE; + ev_io_set(&d->w, PQsocket(d->conn), EV_WRITE); ev_io_start(LEM_ &d->w); lua_settop(T, 2); @@ -622,7 +622,7 @@ db_done_cb(EV_P_ struct ev_io *w, int revents) lua_settop(d->T, 1); (void)PQsetnonblocking(d->conn, 0); d->w.cb = db_exec_cb; - d->w.events = EV_READ; + ev_io_set(&d->w, PQsocket(d->conn), EV_READ); ev_io_start(EV_A_ &d->w); break; @@ -660,7 +660,7 @@ db_done(lua_State *T) (void)PQsetnonblocking(d->conn, 0); d->T = T; d->w.cb = db_exec_cb; - d->w.events = EV_READ; + ev_io_set(&d->w, PQsocket(d->conn), EV_READ); ev_io_start(LEM_ &d->w); lua_settop(d->T, 1); return lua_yield(d->T, 1); @@ -675,7 +675,7 @@ db_done(lua_State *T) d->T = T; d->w.cb = db_done_cb; - d->w.events = EV_WRITE; + ev_io_set(&d->w, PQsocket(d->conn), EV_WRITE); ev_io_start(LEM_ &d->w); if (error == NULL) { @@ -752,7 +752,7 @@ db_get(lua_State *T) lem_debug("would block"); d->T = T; d->w.cb = db_get_cb; - d->w.events = EV_READ; + ev_io_set(&d->w, PQsocket(d->conn), EV_READ); ev_io_start(LEM_ &d->w); lua_settop(T, 1); @@ -768,7 +768,7 @@ db_get(lua_State *T) d->T = T; d->w.cb = db_exec_cb; - d->w.events = EV_READ; + ev_io_set(&d->w, PQsocket(d->conn), EV_READ); ev_io_start(LEM_ &d->w); /* TODO: it is necessary but kinda ugly to call |