set nodelay
This commit is contained in:
parent
253c10e6f3
commit
d7870fe63b
4 changed files with 24 additions and 2 deletions
3
dc11.cpp
3
dc11.cpp
|
@ -70,6 +70,8 @@ void dc11::operator()()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_nodelay(pfds[i].fd);
|
||||||
|
|
||||||
sockaddr_in listen_addr;
|
sockaddr_in listen_addr;
|
||||||
memset(&listen_addr, 0, sizeof(listen_addr));
|
memset(&listen_addr, 0, sizeof(listen_addr));
|
||||||
listen_addr.sin_family = AF_INET;
|
listen_addr.sin_family = AF_INET;
|
||||||
|
@ -115,6 +117,7 @@ void dc11::operator()()
|
||||||
}
|
}
|
||||||
|
|
||||||
pfds[client_i].fd = accept(pfds[i].fd, nullptr, nullptr);
|
pfds[client_i].fd = accept(pfds[i].fd, nullptr, nullptr);
|
||||||
|
set_nodelay(pfds[client_i].fd);
|
||||||
|
|
||||||
registers[i * 4 + 0] |= 0160000; // "ERROR", RING INDICATOR, CARRIER TRANSITION
|
registers[i * 4 + 0] |= 0160000; // "ERROR", RING INDICATOR, CARRIER TRANSITION
|
||||||
if (is_rx_interrupt_enabled(i))
|
if (is_rx_interrupt_enabled(i))
|
||||||
|
|
17
utils.cpp
17
utils.cpp
|
@ -6,7 +6,11 @@
|
||||||
#if defined(ESP32) || defined(BUILD_FOR_RP2040)
|
#if defined(ESP32) || defined(BUILD_FOR_RP2040)
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "rp2040.h"
|
#include "rp2040.h"
|
||||||
|
#else
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -23,6 +27,8 @@
|
||||||
#include "win32.h"
|
#include "win32.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
|
||||||
void setBit(uint16_t & v, const int bit, const bool vb)
|
void setBit(uint16_t & v, const int bit, const bool vb)
|
||||||
{
|
{
|
||||||
|
@ -236,3 +242,14 @@ void update_word(uint16_t *const w, const bool msb, const uint8_t v)
|
||||||
(*w) |= v;
|
(*w) |= v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_nodelay(const int fd)
|
||||||
|
{
|
||||||
|
int flags = 1;
|
||||||
|
#if defined(__FreeBSD__) || defined(ESP32)
|
||||||
|
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags)) == -1)
|
||||||
|
#else
|
||||||
|
if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags)) == -1)
|
||||||
|
#endif
|
||||||
|
DOLOG(warning, true, "Cannot disable nagle algorithm");
|
||||||
|
}
|
||||||
|
|
2
utils.h
2
utils.h
|
@ -25,3 +25,5 @@ ssize_t WRITE(int fd, const char *whereto, size_t len);
|
||||||
ssize_t READ(int fd, char *whereto, size_t len);
|
ssize_t READ(int fd, char *whereto, size_t len);
|
||||||
|
|
||||||
void update_word(uint16_t *const w, const bool msb, const uint8_t v);
|
void update_word(uint16_t *const w, const bool msb, const uint8_t v);
|
||||||
|
|
||||||
|
void set_nodelay(const int fd);
|
||||||
|
|
Loading…
Add table
Reference in a new issue