~ubuntu-branches/ubuntu/saucy/uwsgi/saucy

« back to all changes in this revision

Viewing changes to signal.c

  • Committer: Package Import Robot
  • Author(s): Janos Guljas
  • Date: 2012-04-30 17:35:22 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120430173522-qucwu1au3s9bflhb
Tags: 1.2+dfsg-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
559
559
        return received_signal;
560
560
}
561
561
 
 
562
void uwsgi_receive_signal(int fd, char *name, int id) {
 
563
 
 
564
        uint8_t uwsgi_signal;
 
565
 
 
566
        ssize_t ret = read(fd, &uwsgi_signal, 1);
 
567
 
 
568
        if (ret == 0) {
 
569
                goto destroy;
 
570
        }
 
571
        else if (ret < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
 
572
                uwsgi_error("[uwsgi-signal] read()");
 
573
                goto destroy;
 
574
        }
 
575
        else if (ret > 0) {
 
576
#ifdef UWSGI_DEBUG
 
577
                uwsgi_log_verbose("master sent signal %d to %s %d\n", uwsgi_signal, name, id);
 
578
#endif
 
579
                if (uwsgi_signal_handler(uwsgi_signal)) {
 
580
                        uwsgi_log_verbose("error managing signal %d on %s %d\n", uwsgi_signal, name, id);
 
581
                }
 
582
        }
 
583
 
 
584
        return;
 
585
 
 
586
destroy:
 
587
        // better to kill the whole worker...
 
588
        uwsgi_log_verbose("uWSGI %s %d screams: UAAAAAAH my master disconnected: i will kill myself !!!\n", name, id);
 
589
        end_me(0);
 
590
 
 
591
}