Skip to content

Implement proper signal handling and exiting #2

Description

@kragniz

C-c currently just calls exit(1). This should be improved to cleanly close sockets, write to files and things.

Activity

  1. Danyc0 commented on Oct 20, 2016

    @Danyc0
    Contributor

    The program already seems catch the SIGINT here:
    https://github.com/sails-simulator/sailsd/blob/master/sailsd.c#L382-L386
    So is it just that the code for closing the sockets needs to happen here?

  2. kragniz commented on Oct 20, 2016

    @kragniz
    MemberAuthor

    Yes, it's a question of getting the file handler for the socket (https://github.com/sails-simulator/sailsd/blob/master/sailsd.c#L435) into that scope, then dealing with it.

  3. Danyc0 commented on Oct 20, 2016

    @Danyc0
    Contributor

    Looks like the only way to do that is to put the socket descriptor in the module scope, right? because there's no other way to get a variable into a signal handlers scope

  4. kragniz commented on Oct 20, 2016

    @kragniz
    MemberAuthor

    Yup, something like that would need to be done.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions