1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-09 05:46:32 +00:00

Option so-reuseport did not work

This commit is contained in:
Gerhard Rieger 2016-02-06 16:36:39 +01:00
parent 2ea6da3839
commit 35a7817e48
4 changed files with 61 additions and 31 deletions

View file

@ -168,40 +168,32 @@ int _xioopen_foxec(int xioflags, /* XIO_RDONLY etc. */
}
#endif
/* remember: fdin is the fs where the sub program reads from, thus it is
sock0[]'s read fd */
/*! problem: when fdi==WRFD(sock[0]) or fdo==RDFD(sock[0]) */
if (rw != XIO_WRONLY) {
if (XIO_GETRDFD(sock[0]/*!!*/) == fdi) {
if (Fcntl_l(fdi, F_SETFD, 0) < 0) {
Warn2("fcntl(%d, F_SETFD, 0): %s", fdi, strerror(errno));
}
if (Dup2(XIO_GETRDFD(sock[0]), fdi) < 0) {
Error3("dup2(%d, %d): %s",
XIO_GETRDFD(sock[0]), fdi, strerror(errno));
}
/*0 Info2("dup2(%d, %d)", XIO_GETRDFD(sock[0]), fdi);*/
} else {
if (Dup2(XIO_GETRDFD(sock[0]), fdi) < 0) {
Error3("dup2(%d, %d): %s",
XIO_GETRDFD(sock[0]), fdi, strerror(errno));
}
/*0 Info2("dup2(%d, %d)", XIO_GETRDFD(sock[0]), fdi);*/
}
}
if (rw != XIO_RDONLY) {
if (XIO_GETWRFD(sock[0]) == fdo) {
if (XIO_GETWRFD(sock[0]/*!!*/) == fdo) {
if (Fcntl_l(fdo, F_SETFD, 0) < 0) {
Warn2("fcntl(%d, F_SETFD, 0): %s", fdo, strerror(errno));
}
if (Dup2(XIO_GETWRFD(sock[0]), fdo) < 0) {
Error3("dup2(%d, %d): %s)",
XIO_GETWRFD(sock[0]), fdo, strerror(errno));
}
/*0 Info2("dup2(%d, %d)", XIO_GETWRFD(sock[0]), fdo);*/
} else {
if (Dup2(XIO_GETWRFD(sock[0]), fdo) < 0) {
Error3("dup2(%d, %d): %s)",
Error3("dup2(%d, %d): %s",
XIO_GETWRFD(sock[0]), fdo, strerror(errno));
}
}
/*0 Info2("dup2(%d, %d)", XIO_GETRDFD(sock[0]), fdi);*/
}
if (rw != XIO_RDONLY) {
if (XIO_GETRDFD(sock[0]) == fdi) {
if (Fcntl_l(fdi, F_SETFD, 0) < 0) {
Warn2("fcntl(%d, F_SETFD, 0): %s", fdi, strerror(errno));
}
} else {
if (Dup2(XIO_GETRDFD(sock[0]), fdi) < 0) {
Error3("dup2(%d, %d): %s)",
XIO_GETRDFD(sock[0]), fdi, strerror(errno));
}
/*0 Info2("dup2(%d, %d)", XIO_GETWRFD(sock[0]), fdo);*/
}
}