- if ( (rc = sendto(sock, NULL, 0, MSG_FASTOPEN, s_ptr, s_len)) < 0
- && errno == EOPNOTSUPP
- )
+ if ((rc = sendto(sock, fastopen->data, fastopen->len,
+ MSG_FASTOPEN | MSG_DONTWAIT, s_ptr, s_len)) >= 0)
+ {
+ DEBUG(D_transport|D_v)
+ debug_printf("TCP_FASTOPEN mode connection, with data\n");
+ tcp_out_fastopen = TRUE;
+ }
+ else if (errno == EINPROGRESS) /* expected for nonready peer */
+ {
+ if (!fastopen->data)
+ {
+ DEBUG(D_transport|D_v)
+ debug_printf("TCP_FASTOPEN mode connection, no data\n");
+ tcp_out_fastopen = TRUE;
+ rc = 0;
+ }
+ else if ( (rc = send(sock, fastopen->data, fastopen->len, 0)) < 0
+ && errno == EINPROGRESS) /* expected for nonready peer */
+ rc = 0;
+ }
+ else if(errno == EOPNOTSUPP)