kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 0b3c918ba620b887370621cd8c7a1ab471731c58
parent 9ea1e3cb57ef3b9adecd93c68530d99d9fd076c4
Author: Joris Vink <joris@coders.se>
Date:   Thu, 14 Aug 2014 15:13:47 +0200

Properly check for connection trouble in the pgsql example

Diffstat:
examples/pgsql/src/pgsql.c | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/examples/pgsql/src/pgsql.c b/examples/pgsql/src/pgsql.c @@ -97,11 +97,8 @@ request_perform_query(struct http_request *req) /* Fire off the query. */ if (!kore_pgsql_async(&state->sql, req, "SELECT * FROM coders")) { - /* - * If the sql was NULL we need to retry as there was no - * available connection. - */ - if (state->sql.conn == NULL) { + /* If the state was still INIT, we'll try again later. */ + if (state->sql.state == KORE_PGSQL_STATE_INIT) { req->fsm_state = REQ_STATE_QUERY; return (HTTP_STATE_RETRY); }