swap pollfds order
This commit is contained in:
@@ -244,12 +244,12 @@ int main(int argc, char **argv)
|
||||
|
||||
struct pollfd pollfds[2] = {
|
||||
{
|
||||
.fd = socket,
|
||||
.fd = sigpipe_fds[0],
|
||||
.events = POLLIN,
|
||||
.revents = 0
|
||||
},
|
||||
{
|
||||
.fd = sigpipe_fds[0],
|
||||
.fd = socket,
|
||||
.events = POLLIN,
|
||||
.revents = 0
|
||||
},
|
||||
@@ -259,7 +259,7 @@ int main(int argc, char **argv)
|
||||
if(poll(pollfds, 2, 10000) == 0)
|
||||
continue;
|
||||
|
||||
if(pollfds[0].revents) {
|
||||
if(pollfds[1].revents) {
|
||||
if(find_peer(0)) {
|
||||
int len = recvmsg(socket, &msg , 0);
|
||||
if(len <= 0) continue;
|
||||
@@ -286,7 +286,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if(pollfds[1].revents) {
|
||||
if(pollfds[0].revents) {
|
||||
pid_t pid;
|
||||
int wstatus;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user