Skip to content

Commit 1c4d04f

Browse files
committed
Move ggipc_connect_by_name to private header
1 parent 6f6b728 commit 1c4d04f

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

include/ggl/ipc/client.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#define GGL_IPC_CLIENT_H
77

88
#include <ggl/arena.h>
9-
#include <ggl/attr.h>
109
#include <ggl/buffer.h>
1110
#include <ggl/error.h>
1211
#include <ggl/ipc/error.h>
@@ -18,13 +17,6 @@ struct timespec;
1817

1918
#define GGL_IPC_SVCUID_STR_LEN (16)
2019

21-
/// Connect to GG-IPC server using component name.
22-
/// If svcuid is non-null, it will be filled with the component's identity
23-
/// token. Buffer must be able to hold at least GGL_IPC_SVCUID_STR_LEN.
24-
GglError ggipc_connect_by_name(
25-
GglBuffer socket_path, GglBuffer component_name, int *fd, GglBuffer *svcuid
26-
) NONNULL(3);
27-
2820
GglError ggipc_call(
2921
int conn,
3022
GglBuffer operation,

priv_include/ggl/ipc/client_priv.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
#include <ggl/attr.h>
99
#include <ggl/buffer.h>
1010
#include <ggl/error.h>
11-
#include <ggl/object.h>
1211

13-
/// Connect to GG-IPC server with the given payload.
12+
/// Connect to GG-IPC server using component name.
1413
/// If svcuid is non-null, it will be filled with the component's identity
1514
/// token. Buffer must be able to hold at least GGL_IPC_SVCUID_STR_LEN.
16-
GglError ggipc_connect_with_payload(
17-
GglBuffer socket_path, GglMap payload, int *fd, GglBuffer *svcuid
15+
GglError ggipc_connect_by_name(
16+
GglBuffer socket_path, GglBuffer component_name, int *fd, GglBuffer *svcuid
1817
) NONNULL(3);
1918

2019
GglError ggipc_private_get_system_config(

src/ipc/client.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ static GglError send_message(
4545
GglMap *payload
4646
) NONNULL_IF_NONZERO(2, 5);
4747

48+
static GglError ggipc_connect_with_payload(
49+
GglBuffer socket_path, GglMap payload, int *fd, GglBuffer *svcuid
50+
) NONNULL(3);
51+
4852
static GglError send_message(
4953
int conn,
5054
const EventStreamHeader *headers,
@@ -122,16 +126,28 @@ static GglError get_message(
122126
return GGL_ERR_OK;
123127
}
124128

125-
GglError ggipc_connect_with_payload(
129+
static GglError ggipc_connect_with_payload(
126130
GglBuffer socket_path, GglMap payload, int *fd, GglBuffer *svcuid
127131
) {
128132
int conn = -1;
129133
GglError ret = ggl_connect(socket_path, &conn);
130134
if (ret != GGL_ERR_OK) {
135+
GGL_LOGE(
136+
"Failed to connect to GG-IPC socket at %.*s.",
137+
(int) socket_path.len,
138+
socket_path.data
139+
);
131140
return ret;
132141
}
133142
GGL_CLEANUP_ID(conn_cleanup, cleanup_close, conn);
134143

144+
GGL_LOGI(
145+
"Connected to GG-IPC socket at %.*s on fd %d",
146+
(int) socket_path.len,
147+
socket_path.data,
148+
conn
149+
);
150+
135151
EventStreamHeader headers[] = {
136152
{ GGL_STR(":message-type"),
137153
{ EVENTSTREAM_INT32, .int32 = EVENTSTREAM_CONNECT } },

0 commit comments

Comments
 (0)