Skip to content

Client Socket Pool Repository

Sudheer edited this page Jan 13, 2023 · 15 revisions

A set of functions to manage connections in a connection pool. It is a repository of connection pools,
{ (repos_name, pool_repos) }

where pool_repos is a collection of connections and associated functions to manage the collection
{ (name, [ss_ptr]) }

Synopsis

Initialization of the repository

local ffi = require('ffi');

local repos_loader = package.loadlib("libevpoolrepos.so","luaopen_libevpoolrepos");
local repos_lib = repos_loader();

ffi.cdef[[
void * pin_loaded_so(const char *);
]]
local lib = ffi.C.pin_loaded_so("libevpoolrepos.so");

The repository is maintainer per instance of evlua/evluaserver and will not get reinitialized if already initialized once (ffi is the foreign function interface to lua) The function pin_loaded_so ensures that the loaded dll remains in the process and will not get removed once the dlclose function is called, this is necessary to retain some of the static variables initialized in libevpoolrepos.so.

Clone this wiki locally