Also bring them under single define.
#define BACKENDKEY_LEN 8
+/* buffer size for startup noise */
+#define STARTUP_BUF 1024
+
/*
* Remote/local address
*/
PgStats older_stats;
/* database info to be sent to client */
- uint8_t welcome_msg[256]; /* ServerParams without VarCache ones */
+ uint8_t welcome_msg[STARTUP_BUF]; /* ServerParams without VarCache ones */
unsigned welcome_msg_len;
VarCache orig_vars; /* default params from server */
bool db_auto; /* is the database auto-created by autodb_connstr */
bool admin; /* internal console db */
- uint8_t startup_params[256]; /* partial StartupMessage (without user) be sent to server */
+ uint8_t startup_params[STARTUP_BUF]; /* partial StartupMessage (without user) be sent to server */
unsigned startup_params_len;
PgUser *forced_user; /* if not NULL, the user/psw is forced */
struct cmsghdr *cmsg;
int res;
struct iovec iovec;
- uint8_t pktbuf[1024];
+ uint8_t pktbuf[STARTUP_BUF * 2];
uint8_t cntbuf[CMSG_SPACE(sizeof(int))];
iovec.iov_base = pktbuf;
bool welcome_client(PgSocket *client)
{
int res;
- uint8_t buf[1024];
+ uint8_t buf[STARTUP_BUF];
PktBuf msg;
PgPool *pool = client->pool;
PgDatabase *db = server->pool->db;
const char *username = server->pool->user->name;
PktBuf pkt;
- uint8_t buf[512];
+ uint8_t buf[STARTUP_BUF];
pktbuf_static(&pkt, buf, sizeof(buf));
pktbuf_write_StartupMessage(&pkt, username,
static void takeover_recv_cb(int sock, short flags, void *arg)
{
PgSocket *bouncer = container_of(arg, PgSocket, sbuf);
- uint8_t data_buf[2048];
+ uint8_t data_buf[STARTUP_BUF * 2];
uint8_t cnt_buf[128];
struct msghdr msg;
struct iovec io;
bool varcache_apply(PgSocket *server, PgSocket *client, bool *changes_p)
{
PktBuf pkt;
- uint8_t buf[1024];
+ uint8_t buf[STARTUP_BUF];
int changes = 0;
const char *cval, *sval;
const struct var_lookup *lk;