This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch feat/e-wl-proxy-planb
in repository enlightenment.

View the commit online.

commit a32cf0d01eac288e3a9a81101dc6d21e2d9cff6d
Author: [email protected] <[email protected]>
AuthorDate: Mon Jun 8 10:37:46 2026 -0600

    feat(e_wl_proxy): main accept loop + end-to-end smoke test
---
 src/bin/e_wl_proxy/e_wl_proxy_main.c | 60 ++++++++++++++++++++++++++++++++++++
 src/bin/e_wl_proxy/meson.build       | 16 +++++-----
 src/bin/e_wl_proxy/tests/smoke.sh    | 27 ++++++++++++++++
 3 files changed, 95 insertions(+), 8 deletions(-)

diff --git a/src/bin/e_wl_proxy/e_wl_proxy_main.c b/src/bin/e_wl_proxy/e_wl_proxy_main.c
new file mode 100644
index 000000000..9cfd23590
--- /dev/null
+++ b/src/bin/e_wl_proxy/e_wl_proxy_main.c
@@ -0,0 +1,60 @@
+#define _GNU_SOURCE
+#include "config.h"
+#include "e_wl_proxy.h"
+#include <Ecore.h>
+#include <Eina.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/socket.h>
+
+static const char *_backend_name = NULL;
+
+static Eina_Bool
+_accept_cb(void *data, Ecore_Fd_Handler *fdh)
+{
+   int lfd = (int)(intptr_t)data;
+   int cfd;
+
+   (void)fdh;
+   while ((cfd = accept4(lfd, NULL, NULL, SOCK_CLOEXEC | SOCK_NONBLOCK)) >= 0)
+     {
+        /* conn takes ownership of cfd (closes it on failure) */
+        e_wl_proxy_conn_add(cfd, _backend_name);
+     }
+   return ECORE_CALLBACK_RENEW;
+}
+
+int
+main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
+{
+   const char *public_name;
+   int lfd;
+
+   /* public socket name the session will advertise as WAYLAND_DISPLAY */
+   public_name = getenv("WAYLAND_DISPLAY");
+   if (!public_name || !public_name[0]) public_name = "wayland-0";
+
+   /* backend socket name E will create */
+   _backend_name = getenv("E_WL_SOCKET");
+   if (!_backend_name || !_backend_name[0]) _backend_name = "wayland-e";
+
+   eina_init();
+   ecore_init();
+
+   lfd = e_wl_proxy_listen(public_name);
+   if (lfd < 0)
+     {
+        fprintf(stderr, "e_wl_proxy: cannot create public socket '%s'\n", public_name);
+        return 1;
+     }
+
+   ecore_main_fd_handler_add(lfd, ECORE_FD_READ | ECORE_FD_ERROR,
+                             _accept_cb, (void *)(intptr_t)lfd, NULL, NULL);
+
+   ecore_main_loop_begin();
+
+   ecore_shutdown();
+   eina_shutdown();
+   return 0;
+}
diff --git a/src/bin/e_wl_proxy/meson.build b/src/bin/e_wl_proxy/meson.build
index c0401be04..22b83a124 100644
--- a/src/bin/e_wl_proxy/meson.build
+++ b/src/bin/e_wl_proxy/meson.build
@@ -6,14 +6,14 @@ e_wl_proxy_core = static_library(
 )
 
 # executable enabled in Task 6 (needs e_wl_proxy_conn.c + e_wl_proxy_main.c)
-#executable('e_wl_proxy',
-#           [ 'e_wl_proxy_conn.c', 'e_wl_proxy_main.c' ],
-#           include_directories: include_directories('.'),
-#           link_with          : e_wl_proxy_core,
-#           dependencies       : [ dep_eina, dep_ecore ],
-#           install_dir        : dir_bin,
-#           install            : true
-#          )
+executable('e_wl_proxy',
+           [ 'e_wl_proxy_conn.c', 'e_wl_proxy_main.c' ],
+           include_directories: include_directories('.', '../../..'),
+           link_with          : e_wl_proxy_core,
+           dependencies       : [ dep_eina, dep_ecore ],
+           install_dir        : dir_bin,
+           install            : true
+          )
 
 e_wl_proxy_test_exe = executable('e_wl_proxy_test',
            [ 'tests/e_wl_proxy_test.c' ],
diff --git a/src/bin/e_wl_proxy/tests/smoke.sh b/src/bin/e_wl_proxy/tests/smoke.sh
new file mode 100755
index 000000000..72f8197bc
--- /dev/null
+++ b/src/bin/e_wl_proxy/tests/smoke.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+# End-to-end: a fake backend echo server + a client, through the proxy.
+# Usage: smoke.sh /path/to/e_wl_proxy
+set -e
+PROXY="$1"
+export XDG_RUNTIME_DIR="$(mktemp -d)"
+export WAYLAND_DISPLAY="wayland-smoke"
+export E_WL_SOCKET="wayland-smoke-be"
+
+# fake backend: socat echo server on the backend socket
+socat UNIX-LISTEN:"$XDG_RUNTIME_DIR/$E_WL_SOCKET",fork EXEC:'cat' &
+BE=$!
+sleep 0.3
+
+"$PROXY" &
+PX=$!
+sleep 0.3
+
+# client: send a line through the proxy, expect it echoed back.
+# shut-none keeps the socket fully open after stdin EOF (a real Wayland client
+# never half-closes); -T1 exits after 1s idle once the echo has been read.
+RESULT="$(printf 'hello-proxy\n' | socat -T1 - UNIX-CONNECT:"$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY",shut-none)"
+
+kill $PX $BE 2>/dev/null || true
+rm -rf "$XDG_RUNTIME_DIR"
+
+[ "$RESULT" = "hello-proxy" ] && { echo "SMOKE OK"; exit 0; } || { echo "SMOKE FAIL: '$RESULT'"; exit 1; }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to