Git Product home page Git Product logo

Comments (5)

abeltrano avatar abeltrano commented on May 18, 2024 1

Ok, so I only have to worry about if ztpd received a SIGINT or a SIGTERM for this issue right?

Yep, seems like that's the only place where the event loop is stopped.

from wifi-ztp.

abeltrano avatar abeltrano commented on May 18, 2024

The event_loop_run() return type needs to be changed from void to int, and the return value should indicate the status of the event loop. 0 should be returned from event_loop_run() if the event loop exited cleanly, otherwise, an appropriate negative errno value (eg. -EINVAL, -ENOSYS, etc.) should be returned.

The return value should be specified using the event_loop_stop() function. Its signature should be changed to:

int
event_loop_stop(struct event_loop *loop, int retval)

Where retval is the even loop return status to be returned from event_loop_run(). This value can then be propagated to event_loop_run() (probably through the struct event_loop context with a new field/member).

from wifi-ztp.

forwardpointer avatar forwardpointer commented on May 18, 2024

Do you want the error code to only be propagated if we enter on_signal_received, or should we have the error code from other events, like dpp_start, to also be propagated up to main?

`
on_signal_received(int fd, void *context)
{
struct signalfd_siginfo siginfo;
ssize_t bytes = read(fd, &siginfo, sizeof siginfo);
if (bytes < (ssize_t)(sizeof siginfo)) {
zlog_warning("siginfo read returned too little data");
return;
}

  switch (siginfo.ssi_signo) {
      case SIGINT:
      case SIGTERM:
          event_loop_stop((struct event_loop *)context);
          break;
      default:
          break;
  }

}
`

It looks like this is the only place where event_loop_stop is being used.

from wifi-ztp.

abeltrano avatar abeltrano commented on May 18, 2024

I think it makes sense to only propagate from where event_loop_stop is currently used since that is the only proper/expected way to stop the event loop.

from wifi-ztp.

forwardpointer avatar forwardpointer commented on May 18, 2024

Ok, so I only have to worry about if ztpd received a SIGINT or a SIGTERM for this issue right?

from wifi-ztp.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.