fix glib deprecation warnings
This commit is contained in:
parent
a937bd437a
commit
f1f1aacdfe
|
@ -585,15 +585,18 @@ static liHandlerResult core_handle_static(liVRequest *vr, gpointer param, gpoint
|
|||
}
|
||||
|
||||
if (vr->physical.path->len == 0) return LI_HANDLER_GO_ON;
|
||||
if (vr->physical.path->str[vr->physical.path->len-1] == '/') return LI_HANDLER_GO_ON;
|
||||
|
||||
if (exclude_arr) {
|
||||
const gchar *basep = g_basename(vr->physical.path->str);
|
||||
const GString base = li_const_gstring((gchar*) basep, vr->physical.path->len - (basep - vr->physical.path->str));
|
||||
guint i;
|
||||
GString *tmp_str = vr->wrk->tmp_str;
|
||||
gchar *basep = g_path_get_basename(vr->physical.path->str);
|
||||
g_string_assign(tmp_str, basep);
|
||||
g_free(basep);
|
||||
|
||||
for (i = 0; i < exclude_arr->len; i++) {
|
||||
liValue *v = g_array_index(exclude_arr, liValue*, i);
|
||||
if (li_string_suffix(&base, GSTR_LEN(v->data.string))) {
|
||||
if (li_string_suffix(tmp_str, GSTR_LEN(v->data.string))) {
|
||||
if (no_fail) return LI_HANDLER_GO_ON;
|
||||
|
||||
if (!li_vrequest_handle_direct(vr)) {
|
||||
|
|
|
@ -274,11 +274,21 @@ static liHandlerResult mod_limit_action_handle(liVRequest *vr, gpointer param, g
|
|||
|
||||
switch (ctx->type) {
|
||||
case ML_TYPE_CON:
|
||||
#ifdef GLIB_VERSION_2_30
|
||||
/* since 2.30 g_atomic_int_add does the same as g_atomic_int_exchange_and_add,
|
||||
* before it didn't return the old value. this fixes the deprecation warning. */
|
||||
if (g_atomic_int_add(&ctx->pool.con, 1) > ctx->limit) {
|
||||
g_atomic_int_add(&ctx->pool.con, -1);
|
||||
limit_reached = TRUE;
|
||||
VR_DEBUG(vr, "limit.con: limit reached (%d active connections)", ctx->limit);
|
||||
}
|
||||
#else
|
||||
if (g_atomic_int_exchange_and_add(&ctx->pool.con, 1) > ctx->limit) {
|
||||
g_atomic_int_add(&ctx->pool.con, -1);
|
||||
limit_reached = TRUE;
|
||||
VR_DEBUG(vr, "limit.con: limit reached (%d active connections)", ctx->limit);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case ML_TYPE_CON_IP:
|
||||
g_mutex_lock(ctx->mutex);
|
||||
|
|
Loading…
Reference in New Issue