conditional use of MSG_NOSIGNAL and EPOLLRDHUP
This commit is contained in:
parent
946a17f457
commit
596304d446
@ -133,6 +133,10 @@ int main ()
|
|||||||
sigact.sa_handler = handle_signal;
|
sigact.sa_handler = handle_signal;
|
||||||
sigaction (SIGINT, &sigact, STIO_NULL);
|
sigaction (SIGINT, &sigact, STIO_NULL);
|
||||||
|
|
||||||
|
//STIO_MEMSET (&sigact, 0, STIO_SIZEOF(sigact));
|
||||||
|
//sigact.sa_handler = SIG_IGN;
|
||||||
|
//sigaction (SIGPIPE, &sigact, STIO_NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
pkt = stio_pkt_open (packet type, protocol type); // packet socket
|
pkt = stio_pkt_open (packet type, protocol type); // packet socket
|
||||||
arp = stio_arp_open (binding_addr); // raw socket - arp filter
|
arp = stio_arp_open (binding_addr); // raw socket - arp filter
|
||||||
|
@ -129,9 +129,13 @@ static int tcp_send (stio_dev_t* dev, const void* data, stio_len_t* len)
|
|||||||
{
|
{
|
||||||
stio_dev_tcp_t* tcp = (stio_dev_tcp_t*)dev;
|
stio_dev_tcp_t* tcp = (stio_dev_tcp_t*)dev;
|
||||||
ssize_t x;
|
ssize_t x;
|
||||||
|
int flags = 0;
|
||||||
|
|
||||||
/* flags MSG_DONTROUTE, MSG_DONTWAIT, MSG_MORE, MSG_OOB, MSG_NOSIGNAL */
|
/* flags MSG_DONTROUTE, MSG_DONTWAIT, MSG_MORE, MSG_OOB, MSG_NOSIGNAL */
|
||||||
x = sendto (tcp->sck, data, *len, 0, STIO_NULL, 0);
|
#if defined(MSG_NOSIGNAL)
|
||||||
|
flags |= MSG_NOSIGNAL;
|
||||||
|
#endif
|
||||||
|
x = sendto (tcp->sck, data, *len, flags, STIO_NULL, 0);
|
||||||
if (x <= -1)
|
if (x <= -1)
|
||||||
{
|
{
|
||||||
if (errno == EINPROGRESS || errno == EWOULDBLOCK) return 0; /* no data can be written */
|
if (errno == EINPROGRESS || errno == EWOULDBLOCK) return 0; /* no data can be written */
|
||||||
|
@ -231,7 +231,11 @@ int stio_exec (stio_t* stio)
|
|||||||
int x, events = 0;
|
int x, events = 0;
|
||||||
|
|
||||||
if (stio->revs[i].events & EPOLLERR) events |= STIO_DEV_EVENT_ERR;
|
if (stio->revs[i].events & EPOLLERR) events |= STIO_DEV_EVENT_ERR;
|
||||||
|
#if defined(EPOLLRDHUP)
|
||||||
if (stio->revs[i].events & (EPOLLHUP | EPOLLRDHUP)) events |= STIO_DEV_EVENT_HUP;
|
if (stio->revs[i].events & (EPOLLHUP | EPOLLRDHUP)) events |= STIO_DEV_EVENT_HUP;
|
||||||
|
#else
|
||||||
|
if (stio->revs[i].events & EPOLLHUP) events |= STIO_DEV_EVENT_HUP;
|
||||||
|
#endif
|
||||||
if (stio->revs[i].events & EPOLLIN) events |= STIO_DEV_EVENT_IN;
|
if (stio->revs[i].events & EPOLLIN) events |= STIO_DEV_EVENT_IN;
|
||||||
if (stio->revs[i].events & EPOLLOUT) events |= STIO_DEV_EVENT_OUT;
|
if (stio->revs[i].events & EPOLLOUT) events |= STIO_DEV_EVENT_OUT;
|
||||||
if (stio->revs[i].events & EPOLLPRI) events |= STIO_DEV_EVENT_PRI;
|
if (stio->revs[i].events & EPOLLPRI) events |= STIO_DEV_EVENT_PRI;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user