Skip to content

Comments

capnp router implementation: rpc client server comm#7

Open
dmbk wants to merge 1 commit intomainfrom
feat/node_router
Open

capnp router implementation: rpc client server comm#7
dmbk wants to merge 1 commit intomainfrom
feat/node_router

Conversation

@dmbk
Copy link
Collaborator

@dmbk dmbk commented Oct 19, 2023

Not a complete implementation of the rpc. just the client server communication with random bytes.
Wanted to get the compilation flow right -> automatic generation of capnp files and compilation of the overall thing.
If you run, make sure to kill the server process manually for now.

@dmbk dmbk requested a review from dulaj-me October 19, 2023 13:27
@dmbk dmbk force-pushed the feat/node_router branch 3 times, most recently from ba884bc to 5e99a3e Compare October 20, 2023 11:49
@dmbk dmbk force-pushed the feat/node_router branch from 5e99a3e to 7d0138c Compare October 20, 2023 11:56
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

set(CAPNP_LINKER_FLAGS "-lcapnp -lkj -lcapnp-rpc -lkj-async")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you linked these with target_link_libraries as well. Why do we need to add these to linker flags?

@@ -0,0 +1,43 @@
module;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best not to separate include and src directories. Since we use modules, just use the directory hierarchy as the module hierarchy

@@ -0,0 +1,15 @@
@0x9c4f255fd44cfc76;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we move this somewhere outside the root src dir?


export void test_network()
{
pid_t serverProcess = fork();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to run two processes to recieve and send messages? Is there any way we can do this with only one process?

STATUS_SUCCESS_WITH_DATA
};

struct ResultDefStruct
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does't really like using the type in the name. Isn't uaf::rpc::Response a better name?

}
};

export void start_server(std::string host_address)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to stick to OOP with RAII as much as possible

return kj::Promise<uaf::ResultDefStruct>(std::move(uaf::ResultDefStruct(status, {0x7A, 0x71, 0x72, 0x73})));
}

class ResultDefImpl final : public MessageDefInterface::ResultDef::Server
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks more like a Java naming convention :) Not that clear what this class does

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants