Patch by Robert Gogolok.
return admin_error(admin, "admin access needed");
/*
- * Its very hard to send it reliably over in async manner,
+ * It's very hard to send it reliably over in async manner,
* so turn async off for this resultset.
*/
socket_set_nonblocking(sbuf_socket(&admin->sbuf), 0);
SBuf *sbuf = &client->sbuf;
- /* dont tolerate partial packets */
+ /* don't tolerate partial packets */
if (!get_header(pkt, &pkt_type, &pkt_len)) {
disconnect_client(client, true, "client sent bad pkt header");
return false;
return false;
}
- /* havent requested it */
+ /* haven't requested it */
if (cf_auth_type <= AUTH_TRUST) {
- disconnect_client(client, true, "unreqested passwd pkt");
+ disconnect_client(client, true, "unrequested passwd pkt");
return false;
}
if (!res)
disconnect_server(server, false, "test query failed");
} else
- /* make immidiately available */
+ /* make immediately available */
release_server(server);
}
int active = 0;
int partial_pause = 0;
- /* dont touch anything if takeover is in progress */
+ /* don't touch anything if takeover is in progress */
if (cf_reboot)
return;
}
}
-/* maintaing clients in pool */
+/* maintaining clients in pool */
static void pool_client_maint(PgPool *pool)
{
List *item, *tmp;
}
}
-/* full-scale maintenenace, done only occasionally */
+/* full-scale maintenance, done only occasionally */
static void do_full_maint(int sock, short flags, void *arg)
{
List *item;
PgPool *pool;
- /* dont touch anything if takeover is in progress */
+ /* don't touch anything if takeover is in progress */
if (cf_reboot)
goto skip;
}
/* as [pgbouncer] section can be loaded after databases,
- theres need for review */
+ there's need for review */
void config_postprocess(void)
{
List *item;
char **str_p = elem->dst;
char *tmp;
- /* dont touch if not changed */
+ /* don't touch if not changed */
if (*str_p && strcmp(*str_p, val) == 0)
return true;
{
log_info("Got SIGINT, shutting down");
if (cf_reboot)
- fatal("Takeover was in progress, going down immidiately");
+ fatal("Takeover was in progress, going down immediately");
cf_pause_mode = P_PAUSE;
cf_shutdown = 1;
}
sk->auth_user = NULL;
}
-/* allocate & fll client socket */
+/* allocate & fill client socket */
static PgSocket *new_client(void)
{
PgSocket *client;
break;
case SV_IDLE:
if (server->close_needed)
- /* try to avoid immidiate usage then */
+ /* try to avoid immediate usage then */
statlist_append(&server->head, &pool->idle_server_list);
else
/* otherwise use LIFO */
return user;
}
-/* find a existing database */
+/* find an existing database */
PgDatabase *find_database(const char *name)
{
List *item;
change_server_state(server, newstate);
- /* immidiately process waiters, to give fair chance */
+ /* immediately process waiters, to give fair chance */
if (newstate == SV_IDLE) {
PgSocket *client = first_socket(&pool->waiting_client_list);
if (client) {
/* send reason to client */
if (notify && reason) {
/*
- * dont send Ready pkt here, or client wont notice
+ * don't send Ready pkt here, or client won't notice
* closed connection
*/
send_pooler_error(client, false, reason);
return;
}
- /* if server bounces, dont retry too fast */
+ /* if server bounces, don't retry too fast */
if (pool->last_connect_failed) {
usec_t now = get_cached_time();
if (now - pool->last_connect_time < cf_server_login_retry) {
slog_debug(client, "logged in");
- /* in suspend, dont let send query */
+ /* in suspend, don't let send query */
if (cf_pause_mode == P_SUSPEND)
suspend_socket(client);
fd = accept(sock, &addr.sa, &len);
if (fd < 0) {
/*
- * probably fd limit, pointess to try often
+ * probably fd limit, pointless to try often
* wait a bit, hope that admin resolves somehow
*/
log_error("accept() failed: %s", strerror(errno));
/*
* if less that this amount of data is pending, then
- * prefer to merge if with next recv()
+ * prefer to merge it with next recv()
*/
#define SMALL_PKT 16
}
}
-/* dont wait for data on this socket */
+/* don't wait for data on this socket */
void sbuf_pause(SBuf *sbuf)
{
AssertActive(sbuf);
/*
* There may be some data already received,
* but not certain, so avoid SKIP_RECV.
- * Anyway, it affect only client sockets.
+ * Anyway, it affects only client sockets.
*/
sbuf_main_loop(sbuf, DO_RECV);
}
sbuf->dst = dst;
}
-/* proto_fn tells to skip sone amount of bytes */
+/* proto_fn tells to skip some amount of bytes */
void sbuf_prepare_skip(SBuf *sbuf, int amount)
{
AssertActive(sbuf);
* and processing can continue.
*
* If it returned false it used sbuf_pause(), sbuf_close() or simply
- * wants to wait for next event loop (eg. too few data available).
+ * wants to wait for next event loop (e.g. too few data available).
* Callee should not touch sbuf in that case and just return to libevent.
*/
static bool sbuf_call_proto(SBuf *sbuf, int event)
return res;
}
-/* lets wait for new data */
+/* let's wait for new data */
static void sbuf_wait_for_data(SBuf *sbuf)
{
event_set(&sbuf->ev, sbuf->sock, EV_READ | EV_PERSIST, sbuf_recv_cb, sbuf);
sbuf_main_loop(sbuf, SKIP_RECV);
}
-/* socket is full, wait until its writable again */
+/* socket is full, wait until it's writable again */
static void sbuf_queue_send(SBuf *sbuf)
{
AssertActive(sbuf);
}
/*
- * Theres data in buffer to be sent. returns bool if processing can continue.
+ * There's data in buffer to be sent. Returns bool if processing can continue.
*
* Does not look at pkt_pos/remain fields, expects them to be merged to send_*
*/
AssertActive(sbuf);
/*
- * Should do sbuf_queue_send() immidiately?
+ * Should do sbuf_queue_send() immediately?
*
- * To be sure, lets run into EAGAIN.
+ * To be sure, let's run into EAGAIN.
*/
if (res < avail)
goto try_more;
* Connect to running bouncer process, load fds from it, shut it down
* and continue with them.
*
- * Each row from SHOW FDS will have corresponging fd in ancillary message.
+ * Each row from SHOW FDS will have corresponding fd in ancillary message.
*
* Manpages: unix, sendmsg, recvmsg, cmsg, readv
*/
}
/*
- * cache time, as we dont need sub-second precision
+ * cache time, as we don't need sub-second precision
*/
static usec_t time_cache = 0;
if (res < 0)
fatal_perror("fcntl FD_CLOEXEC");
- /* when no data avail, return EAGAIN instead blocking */
+ /* when no data available, return EAGAIN instead blocking */
socket_set_nonblocking(sock, 1);
#ifdef SO_NOSIGPIPE
if (res < 0)
fatal_perror("setsockopt TCP_KEEPCNT");
}
- /* how lond the connection can stay idle before sending keepalive pkts */
+ /* how long the connection can stay idle before sending keepalive pkts */
if (cf_tcp_keepidle) {
val = cf_tcp_keepidle;
res = setsockopt(sock, IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val));