summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix von Leitner <felix-libowfat@fefe.de>2018-07-09 21:01:37 +0000
committerFelix von Leitner <felix-libowfat@fefe.de>2018-07-09 21:01:37 +0000
commitda1d2a6554f90b7c7dfb162a7f606f4199c2a31f (patch)
treec4960e92c63dda7cc14050623e3274d1a57ec34e
parent7bfadf4dea67e8862bc7aedeea62197b028ac1fa (diff)
downloadlibowfat-da1d2a6554f90b7c7dfb162a7f606f4199c2a31f.tar.gz
libowfat-da1d2a6554f90b7c7dfb162a7f606f4199c2a31f.zip
make fastopen fall back to connect if len==0
-rw-r--r--io.h2
-rw-r--r--socket/socket_fastopen_connect4.c6
-rw-r--r--socket/socket_fastopen_connect6.c6
3 files changed, 11 insertions, 3 deletions
diff --git a/io.h b/io.h
index 5284245..14b96f4 100644
--- a/io.h
+++ b/io.h
@@ -177,7 +177,7 @@ enum {
IOM_WRITE=2,
IOM_ERROR=4
};
-/* return -1 if error, or | of IOM_READ, IOM_WRITE or IOM_ERROR */
+/* return -1 if error, events can be IOM_READ or IOM_WRITE */
int iom_add(iomux_t* c,int64 s,unsigned int events);
/* Blocking wait for single event, timeout in milliseconds */
diff --git a/socket/socket_fastopen_connect4.c b/socket/socket_fastopen_connect4.c
index 188c0b3..8893743 100644
--- a/socket/socket_fastopen_connect4.c
+++ b/socket/socket_fastopen_connect4.c
@@ -13,7 +13,11 @@ ssize_t socket_fastopen_connect4(int s,const char* ip,uint16 port,const char* bu
int r;
{
#else
- int r=socket_send4_flag(s,buf,len,ip,port,MSG_FASTOPEN);
+ 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) {
#endif
/* apparently the kernel does not support TCP fast open */
diff --git a/socket/socket_fastopen_connect6.c b/socket/socket_fastopen_connect6.c
index 33ae21f..5b52af9 100644
--- a/socket/socket_fastopen_connect6.c
+++ b/socket/socket_fastopen_connect6.c
@@ -13,7 +13,11 @@ ssize_t socket_fastopen_connect6(int s,const char* ip,uint16 port,uint32_t scope
int r;
{
#else
- int r=socket_send6_flag(s,buf,len,ip,port,scope_id,MSG_FASTOPEN);
+ int r;
+ if (len)
+ 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) {
#endif
/* apparently the kernel does not support TCP fast open */