Browse Source

evcom upgrade - ignore sigpipe. remove error output.

v0.7.4-release
Ryan 16 years ago
parent
commit
a8813fcdf5
  1. 10
      deps/evcom/evcom.c
  2. 3
      deps/evcom/evcom.h
  3. 2
      deps/evcom/test/test.c
  4. 4
      src/net.h
  5. 1
      src/node.cc

10
deps/evcom/evcom.c

@ -32,6 +32,8 @@
#include <errno.h>
#include <string.h> /* memset */
#include <signal.h>
#include <netinet/tcp.h> /* TCP_NODELAY */
#include <sys/types.h>
#include <sys/socket.h> /* shutdown */
@ -135,6 +137,14 @@ evcom_buf_new (const char *base, size_t len)
return buf;
}
void evcom_ignore_sigpipe (void)
{
struct sigaction sa;
bzero(&sa, sizeof(sa));
sa.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &sa, NULL);
}
static int
close_asap (evcom_descriptor *d)
{

3
deps/evcom/evcom.h

@ -159,6 +159,9 @@ typedef struct evcom_server {
(*on_connection)(struct evcom_server *, struct sockaddr *remote_addr);
} evcom_server;
/* Highly recommended to ignore SIGPIPE! */
void evcom_ignore_sigpipe (void);
void evcom_reader_init (evcom_reader*);
void evcom_reader_set (evcom_reader*, int fd);
void evcom_reader_attach (EV_P_ evcom_reader*);

2
deps/evcom/test/test.c

@ -776,6 +776,8 @@ main (void)
fprintf(stderr, "sizeof(evcom_reader): %d\n", (int)sizeof(evcom_reader));
fprintf(stderr, "sizeof(evcom_writer): %d\n", (int)sizeof(evcom_writer));
evcom_ignore_sigpipe();
#if EVCOM_HAVE_GNUTLS
gnutls_global_init();

4
src/net.h

@ -95,10 +95,6 @@ private:
connection->OnClose();
if (s->errorno) {
printf("socket died: %s\n", strerror(s->errorno));
}
assert(connection->attached_);
connection->Detach();

1
src/node.cc

@ -318,6 +318,7 @@ ParseArgs (int *argc, char **argv)
int
main (int argc, char *argv[])
{
evcom_ignore_sigpipe();
ev_default_loop(EVFLAG_AUTO); // initialize the default ev loop.
// start eio thread pool

Loading…
Cancel
Save