ssa_log.c: Set flog pointer to NULL after fclose in ssa_close_log

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa_log.c: Avoid closing stderr or stdout in ssa_close_log

SSA may use stderr or stdout for log. If an application
uses stderr or stdout after, this will likely crash the application
in unexpected way.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
[core distrib acm]: Move ssa log closing after cleanup

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
Revert "plugin/configure.ac: Removed no longer needed glib check"

This reverts commit 5bcf3b8ef987fa78aad295abd4ae32fdfbe681a2

glib is now needed (again).

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
[acm distrib]/configure.in: Add Glib checking to ibacm and ibssa applications

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
[plugin distrib acm]/configure: Add check for g_thread_init function

AC_CHECK_LIB adds to dependencies necessary for g_thread_init.
The function's dependency is different from other Glib
threading routines.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
[plugin distrib acm]/Makefile.am: Add Glib support to Makefiles

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Initialize the Glib thread subsystem based on GLIB version

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Create Glib pthread pool for issuing rclose

rclose can take 30-90 seconds depending on certain parameters
and don't want to block upstream/downstream threads when rclose
is needed.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Add logging before and after rclose in g_rclose_callback

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Push rclose to thread pool

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: In ssa_cleanup, report number of rsockets waiting to be closed

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Call g_thread_init only if Glib ver < 2.32

From : https://developer.gnome.org/glib/stable/glib-Deprecated-Thread-APIs.html#g-thread-init

g_thread_init has been deprecated since version 2.32 and should
not be used in newly-written code. This function is no longer necessary.
The GLib threading system is automatically initialized
at the start of your program.

Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
ssa.c: Store in ssa_access_member raw pointer to PRDB
ssa.c: Move prdb_current assigment into sa_calculate_prdb function
ssa.c: Set PRDB epoch after computationwq
ssa.c: Destroy prev. PRDB if new one was compute
git st! REMOVE git st! Copy PRDB
ssa.c: Defer PRDB update in downstream if connection is not idlewq
ssa.c: Use prdb epoch computed by access