Skip to content

Commit

Permalink
Debugging shizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
davmac314 committed Oct 1, 2024
1 parent 6a854d3 commit 28fb00a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dinitctl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1012,14 +1012,17 @@ static int start_stop_service(int socknum, cpbuffer_t &rbuffer, const char *serv
rbuffer.consume(1); // consume header

if (reply_pkt_h == cp_rply::PREACK) {
std::cout << "*** got PREACK" << std::endl; // XXX
// We should consider state changes seen only after the PREACK (i.e. between the
// PREACK and the main reply):
seen_states.started = false;
seen_states.stopped = false;
seen_states.failed_start = false;

std::cout << "*** waiting for reply after PREACK" << std::endl; // XXX
// PREACK will be followed by a 2nd reply, get that now:
wait_for_reply(rbuffer, socknum, handle, &seen_states);
std::cout << "*** got reply after PREACK" << std::endl; // XXX
reply_pkt_h = (cp_rply)rbuffer[0];
rbuffer.consume(1);
}
Expand Down
5 changes: 5 additions & 0 deletions src/includes/dinit-client.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <cstdint>
#include <cstring>

#include <iostream>

#include <sys/types.h>
#include <pwd.h>

Expand Down Expand Up @@ -239,12 +241,15 @@ inline void wait_for_reply(cpbuffer_t &rbuffer, int fd, dinit_cptypes::handle_t

if (ev_handle == handle) {
if (event == service_event_t::STOPPED) {
std::cout << "*** got SERVICEEVENT STOPPED" << std::endl;
seen_states->stopped = true;
}
if (event == service_event_t::STARTED) {
std::cout << "*** got SERVICEEVENT STARTED" << std::endl;
seen_states->started = true;
}
if (event == service_event_t::FAILEDSTART) {
std::cout << "*** got SERVICEEVENT FAILEDSTART" << std::endl;
stopped_reason_t stop_reason =
static_cast<stopped_reason_t>(rbuffer[base_pkt_size + 2]);

Expand Down

0 comments on commit 28fb00a

Please sign in to comment.