61 {
62 FILE* out = my->out;
63
64 string message =
format_string(
"DMLOG " + m.get_format() +
"\n", m.get_data() );
65
66 auto remaining_size = message.size();
68 while (!my->is_stopped && remaining_size) {
69 auto written = fwrite(
message_ptr,
sizeof(
char), remaining_size, out);
70
71
72 if(written == 0 && errno != EINTR)
73 {
74 my->is_stopped = true;
75 }
76
77 if(written != remaining_size)
78 {
79 fprintf(stderr, "DMLOG FPRINTF_FAILED failed written=%lu remaining=%lu %d %s\n", written, remaining_size, ferror(out), strerror(errno));
80 clearerr(out);
81 }
82
83 if(my->is_stopped)
84 {
85 fprintf(stderr, "DMLOG FPRINTF_FAILURE_TERMINATED\n");
86
87
88
89
90 kill(getpid(), SIGTERM);
91 }
92
94 remaining_size -= written;
95 }
96 }
websocketpp::config::asio_tls_client::message_type::ptr message_ptr
fc::string format_string(const fc::string &, const variant_object &, bool minimize=false)