* first time :ok or :fail is called. If acquired && !retired at __gc
* time, the destructor calls rspamd_upstream_release so abandoned
* selections don't permanently skew P2C scoring. Wrappers handed out
- * by all_upstreams() or watch callbacks set acquired = FALSE and the
- * destructor leaves inflight alone.
+ * by all_upstreams() or watch callbacks set acquired = 0 and the
+ * destructor leaves inflight alone. Bitfields keep the wrapper at
+ * sizeof(ptr) + 8 instead of bloating it with two padded gint slots.
*/
- gboolean acquired;
- gboolean retired;
+ unsigned int acquired : 1;
+ unsigned int retired : 1;
};
/* Common utility functions */
}
rspamd_upstream_fail(up->up, fail_addr, reason);
- up->retired = TRUE;
+ up->retired = 1;
}
return 0;
if (up) {
rspamd_upstream_ok(up->up);
- up->retired = TRUE;
+ up->retired = 1;
}
return 0;
lua_ups = lua_newuserdata(L, sizeof(*lua_ups));
lua_ups->up = up;
- lua_ups->acquired = acquired;
- lua_ups->retired = FALSE;
+ lua_ups->acquired = acquired ? 1 : 0;
+ lua_ups->retired = 0;
rspamd_lua_setclass(L, rspamd_upstream_classname, -1);
/* Store parent in the upstream to prevent gc */
lua_pushvalue(L, up_idx);
struct rspamd_lua_upstream *lua_ups = lua_newuserdata(L, sizeof(*lua_ups));
lua_ups->up = up;
/* Watcher event: no inflight reference, leave it that way on __gc. */
- lua_ups->acquired = FALSE;
- lua_ups->retired = FALSE;
+ lua_ups->acquired = 0;
+ lua_ups->retired = 0;
rspamd_lua_setclass(L, rspamd_upstream_classname, -1);
/* Store parent in the upstream to prevent gc */
lua_rawgeti(L, LUA_REGISTRYINDEX, cdata->parent_cbref);