Browse Source

make fastopen fall back to connect if len==0

master
Felix von Leitner 2 years ago
parent
commit
da1d2a6554
3 changed files with 11 additions and 3 deletions
  1. +1
    -1
      io.h
  2. +5
    -1
      socket/socket_fastopen_connect4.c
  3. +5
    -1
      socket/socket_fastopen_connect6.c

+ 1
- 1
io.h View File

@@ -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 */


+ 5
- 1
socket/socket_fastopen_connect4.c View File

@@ -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 */


+ 5
- 1
socket/socket_fastopen_connect6.c View File

@@ -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 */


Loading…
Cancel
Save