summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix von Leitner <felix-libowfat@fefe.de>2018-12-14 13:54:26 +0000
committerFelix von Leitner <felix-libowfat@fefe.de>2018-12-14 13:54:26 +0000
commitd4adc803fe6a06658da2cd0f4af6760d13408588 (patch)
treefc4e55444e189ce4bf20b410b5f25747bbbc970f
parent40178af0af6e6007c011f3b84f23dd656d6c7285 (diff)
downloadlibowfat-d4adc803fe6a06658da2cd0f4af6760d13408588.tar.gz
libowfat-d4adc803fe6a06658da2cd0f4af6760d13408588.zip
systems without fastopen support return EPIPE
-rw-r--r--socket/socket_fastopen_connect4.c5
-rw-r--r--socket/socket_fastopen_connect6.c2
2 files changed, 3 insertions, 4 deletions
diff --git a/socket/socket_fastopen_connect4.c b/socket/socket_fastopen_connect4.c
index 8893743..5b38dc6 100644
--- a/socket/socket_fastopen_connect4.c
+++ b/socket/socket_fastopen_connect4.c
@@ -9,16 +9,15 @@
#include <errno.h>
ssize_t socket_fastopen_connect4(int s,const char* ip,uint16 port,const char* buf,size_t len) {
-#ifndef MSG_FASTOPEN
int r;
+#ifndef MSG_FASTOPEN
{
#else
- int r;
if (len)
r=socket_send4_flag(s,buf,len,ip,port,MSG_FASTOPEN);
else
r=socket_connect4(s,ip,port);
- if (r==-1 && errno==ENOTCONN) {
+ if (r==-1 && (errno==ENOTCONN || errno==EPIPE)) {
#endif
/* apparently the kernel does not support TCP fast open */
r=socket_connect4(s,ip,port);
diff --git a/socket/socket_fastopen_connect6.c b/socket/socket_fastopen_connect6.c
index 5b52af9..b6f121b 100644
--- a/socket/socket_fastopen_connect6.c
+++ b/socket/socket_fastopen_connect6.c
@@ -18,7 +18,7 @@ ssize_t socket_fastopen_connect6(int s,const char* ip,uint16 port,uint32_t scope
r=socket_send6_flag(s,buf,len,ip,port,scope_id,MSG_FASTOPEN);
else
r=socket_connect6(s,ip,port,scope_id);
- if (r==-1 && errno==ENOTCONN) {
+ if (r==-1 && (errno==ENOTCONN || errno==EPIPE)) {
#endif
/* apparently the kernel does not support TCP fast open */
r=socket_connect6(s,ip,port,scope_id);