Skip to content

Commit

Permalink
add nodelay to lwipstack
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasKarel committed Nov 11, 2024
1 parent 32b0488 commit a35a7d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
12 changes: 12 additions & 0 deletions connectivity/lwipstack/source/LWIPStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,18 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co

s->conn->pcb.tcp->keep_intvl = *(int *)optval;
return 0;

case NSAPI_NODELAY:
if (optlen != sizeof(int) || NETCONNTYPE_GROUP(s->conn->type) != NETCONN_TCP) {
return NSAPI_ERROR_UNSUPPORTED;
}
if(*(int *)optval == 1) {
tcp_nagle_disable(s->conn->pcb.tcp);
}
else {
tcp_nagle_enable(s->conn->pcb.tcp);
}
return 0;
#endif

case NSAPI_REUSEADDR:
Expand Down
3 changes: 2 additions & 1 deletion connectivity/netsocket/include/netsocket/nsapi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ typedef enum nsapi_socket_option {
NSAPI_STAGGER, /*!< Read estimated stagger value to destination */
NSAPI_IPTOS, /*!< Set IP type of service to set specific precedence */
NSAPI_BROADCAST, /*!< Set broadcast flag for UDP socket */
NSAPI_PKTINFO /*!< Get additional information when using sendto_control/recvfrom_control */
NSAPI_PKTINFO, /*!< Get additional information when using sendto_control/recvfrom_control */
NSAPI_NODELAY, /*!< Disable the nagle algorithm */
} nsapi_socket_option_t;

typedef enum nsapi_tlssocket_level {
Expand Down

0 comments on commit a35a7d2

Please sign in to comment.