mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Fixes for tcpasync (#20411)
This commit is contained in:
parent
af2b90caac
commit
15b40801d4
@ -12,7 +12,7 @@ import sys
|
|||||||
sys.path().push('src/embedded') # allow to import from src/embedded
|
sys.path().push('src/embedded') # allow to import from src/embedded
|
||||||
|
|
||||||
# globals that need to exist to make compilation succeed
|
# globals that need to exist to make compilation succeed
|
||||||
var globs = "path,ctypes_bytes_dyn,tasmota,ccronexpr,gpio,light,webclient,load,MD5,lv,light_state,udp,I2C_Driver,"
|
var globs = "path,ctypes_bytes_dyn,tasmota,ccronexpr,gpio,light,webclient,load,MD5,lv,light_state,udp,I2C_Driver,tcpserver,"
|
||||||
"lv_clock,lv_clock_icon,lv_signal_arcs,lv_signal_bars,lv_wifi_arcs_icon,lv_wifi_arcs,"
|
"lv_clock,lv_clock_icon,lv_signal_arcs,lv_signal_bars,lv_wifi_arcs_icon,lv_wifi_arcs,"
|
||||||
"lv_wifi_bars_icon,lv_wifi_bars,"
|
"lv_wifi_bars_icon,lv_wifi_bars,"
|
||||||
"_lvgl,"
|
"_lvgl,"
|
||||||
|
@ -557,8 +557,7 @@ class Tasmota
|
|||||||
|
|
||||||
# iterate and call each closure
|
# iterate and call each closure
|
||||||
var i = 0
|
var i = 0
|
||||||
var sz = size(fl)
|
while i < size(fl)
|
||||||
while i < sz
|
|
||||||
# note: this is not guarded in try/except for performance reasons. The inner function must not raise exceptions
|
# note: this is not guarded in try/except for performance reasons. The inner function must not raise exceptions
|
||||||
fl[i]()
|
fl[i]()
|
||||||
i += 1
|
i += 1
|
||||||
|
@ -110,12 +110,12 @@ be_local_closure(Tasmota_fast_loop, /* name */
|
|||||||
0x600C000C, // 0005 GETGBL R3 G12
|
0x600C000C, // 0005 GETGBL R3 G12
|
||||||
0x5C100200, // 0006 MOVE R4 R1
|
0x5C100200, // 0006 MOVE R4 R1
|
||||||
0x7C0C0200, // 0007 CALL R3 1
|
0x7C0C0200, // 0007 CALL R3 1
|
||||||
0x14100403, // 0008 LT R4 R2 R3
|
0x140C0403, // 0008 LT R3 R2 R3
|
||||||
0x78120003, // 0009 JMPF R4 #000E
|
0x780E0003, // 0009 JMPF R3 #000E
|
||||||
0x94100202, // 000A GETIDX R4 R1 R2
|
0x940C0202, // 000A GETIDX R3 R1 R2
|
||||||
0x7C100000, // 000B CALL R4 0
|
0x7C0C0000, // 000B CALL R3 0
|
||||||
0x00080502, // 000C ADD R2 R2 K2
|
0x00080502, // 000C ADD R2 R2 K2
|
||||||
0x7001FFF9, // 000D JMP #0008
|
0x7001FFF6, // 000D JMP #0005
|
||||||
0x80000000, // 000E RET 0
|
0x80000000, // 000E RET 0
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -186,8 +186,7 @@ public:
|
|||||||
stop();
|
stop();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// AddLog(LOG_LEVEL_DEBUG, "BRY: tcpclientasync unexpected: RES: %d, ERR: %d", res, errno);
|
// AddLog(LOG_LEVEL_DEBUG, "BRY: tcpclientasync unexpected: RES: %d, ERR: %d, sockfd=%d", res, errno, sockfd);
|
||||||
stop();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,8 +38,6 @@ class WiFiServerAsync {
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void listenOnLocalhost(){}
|
|
||||||
|
|
||||||
WiFiServerAsync(uint16_t port=80, uint8_t max_clients=4):sockfd(-1),_accepted_sockfd(-1),_addr(),_port(port),_max_clients(max_clients),_listening(false),_noDelay(false) {
|
WiFiServerAsync(uint16_t port=80, uint8_t max_clients=4):sockfd(-1),_accepted_sockfd(-1),_addr(),_port(port),_max_clients(max_clients),_listening(false),_noDelay(false) {
|
||||||
}
|
}
|
||||||
WiFiServerAsync(const IPAddress& addr, uint16_t port=80, uint8_t max_clients=4):sockfd(-1),_accepted_sockfd(-1),_addr(addr),_port(port),_max_clients(max_clients),_listening(false),_noDelay(false) {
|
WiFiServerAsync(const IPAddress& addr, uint16_t port=80, uint8_t max_clients=4):sockfd(-1),_accepted_sockfd(-1),_addr(addr),_port(port),_max_clients(max_clients),_listening(false),_noDelay(false) {
|
||||||
@ -117,8 +115,11 @@ AsyncTCPClient * WiFiServerAsync::availableAsync(){
|
|||||||
int val = 1;
|
int val = 1;
|
||||||
if(setsockopt(client_sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&val, sizeof(int)) == ESP_OK) {
|
if(setsockopt(client_sock, SOL_SOCKET, SO_KEEPALIVE, (char*)&val, sizeof(int)) == ESP_OK) {
|
||||||
val = _noDelay;
|
val = _noDelay;
|
||||||
if(setsockopt(client_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&val, sizeof(int)) == ESP_OK)
|
if(setsockopt(client_sock, IPPROTO_TCP, TCP_NODELAY, (char*)&val, sizeof(int)) == ESP_OK) {
|
||||||
return new AsyncTCPClient(client_sock);
|
if (fcntl(client_sock, F_SETFL, fcntl(sockfd, F_GETFL, 0) | O_NONBLOCK ) == ESP_OK) { // set non-blocking
|
||||||
|
return new AsyncTCPClient(client_sock);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new AsyncTCPClient();
|
return new AsyncTCPClient();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user