Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::eosvmoc::compile_monitor Struct Reference
Collaboration diagram for sysio::chain::eosvmoc::compile_monitor:

Public Member Functions

 compile_monitor (boost::asio::io_context &ctx, local::datagram_protocol::socket &&n, wrapped_fd &&t)
 
void wait_for_new_incomming_session (boost::asio::io_context &ctx)
 

Public Attributes

local::datagram_protocol::socket _nodeop_socket
 
wrapped_fd _trampoline_socket
 
std::list< compile_monitor_session_compile_sessions
 

Detailed Description

Definition at line 185 of file compile_monitor.cpp.

Constructor & Destructor Documentation

◆ compile_monitor()

sysio::chain::eosvmoc::compile_monitor::compile_monitor ( boost::asio::io_context & ctx,
local::datagram_protocol::socket && n,
wrapped_fd && t )
inline

Definition at line 186 of file compile_monitor.cpp.

186 : _nodeop_socket(std::move(n)), _trampoline_socket(std::move(t)) {
187 //the only duty of compile_monitor is to create a compile_monitor_session when a code_cache instance
188 // in nodeop wants one
190 }
local::datagram_protocol::socket _nodeop_socket
void wait_for_new_incomming_session(boost::asio::io_context &ctx)
Here is the call graph for this function:

Member Function Documentation

◆ wait_for_new_incomming_session()

void sysio::chain::eosvmoc::compile_monitor::wait_for_new_incomming_session ( boost::asio::io_context & ctx)
inline

Definition at line 192 of file compile_monitor.cpp.

192 {
193 _nodeop_socket.async_wait(boost::asio::local::datagram_protocol::socket::wait_read, [this, &ctx](auto ec) {
194 if(ec) {
195 ctx.stop();
196 return;
197 }
198 auto [success, message, fds] = read_message_with_fds(_nodeop_socket);
199 if(!success) { //failure reading indicates that nodeop has shut down
200 ctx.stop();
201 return;
202 }
203 if(!std::holds_alternative<initialize_message>(message) || fds.size() != 2) {
204 ctx.stop();
205 return;
206 }
207 try {
208 local::datagram_protocol::socket _socket_for_comm(ctx);
209 _socket_for_comm.assign(local::datagram_protocol(), fds[0].release());
210 _compile_sessions.emplace_front(ctx, std::move(_socket_for_comm), std::move(fds[1]), _trampoline_socket);
211 _compile_sessions.front().connection_dead_signal.connect([&, it = _compile_sessions.begin()]() {
212 ctx.post([&]() {
213 _compile_sessions.erase(it);
214 });
215 });
216 write_message_with_fds(_nodeop_socket, initalize_response_message());
217 }
218 catch(const std::exception& e) {
219 write_message_with_fds(_nodeop_socket, initalize_response_message{e.what()});
220 }
221 catch(...) {
222 write_message_with_fds(_nodeop_socket, initalize_response_message{"Failed to create compile process"});
223 }
224
226 });
227 }
bool write_message_with_fds(boost::asio::local::datagram_protocol::socket &s, const eosvmoc_message &message, const std::vector< wrapped_fd > &fds=std::vector< wrapped_fd >())
std::tuple< bool, eosvmoc_message, std::vector< wrapped_fd > > read_message_with_fds(boost::asio::local::datagram_protocol::socket &s)
std::list< compile_monitor_session > _compile_sessions
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _compile_sessions

std::list<compile_monitor_session> sysio::chain::eosvmoc::compile_monitor::_compile_sessions

Definition at line 232 of file compile_monitor.cpp.

◆ _nodeop_socket

local::datagram_protocol::socket sysio::chain::eosvmoc::compile_monitor::_nodeop_socket

Definition at line 229 of file compile_monitor.cpp.

◆ _trampoline_socket

wrapped_fd sysio::chain::eosvmoc::compile_monitor::_trampoline_socket

Definition at line 230 of file compile_monitor.cpp.


The documentation for this struct was generated from the following file: