make fastopen fall back to connect if len==0

master
leitner 6 years ago
parent 3873bab74b
commit 1137831ddd

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

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

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