Rework connect_uiserver call based on gpgex
* src/engine-assuan.c (connect_uiserver): Use proper locking. Improve retry handling.