again:
#if ESP_RANDOM_TCP_PORT
- tcp_port = system_get_time();
- if (tcp_port < 0)
- tcp_port = LWIP_RAND() - tcp_port;
- tcp_port %= TCP_LOCAL_PORT_RANGE_START;
+ tcp_port = abs(LWIP_RAND()) % (TCP_LOCAL_PORT_RANGE_END - TCP_LOCAL_PORT_RANGE_START);
+ tcp_port += TCP_LOCAL_PORT_RANGE_START;
#else
- if (tcp_port++ == TCP_LOCAL_PORT_RANGE_END) {
- tcp_port = TCP_LOCAL_PORT_RANGE_START;
- }
+ if (tcp_port++ == TCP_LOCAL_PORT_RANGE_END) {
+ tcp_port = TCP_LOCAL_PORT_RANGE_START;
+ }
#endif
/* Check all PCB lists. */
#define sys_sem_valid( x ) ( ( ( *x ) == NULL) ? pdFALSE : pdTRUE )\r
#define sys_sem_set_invalid( x ) ( ( *x ) = NULL )\r
\r
-uint32_t system_get_time(void);
void sys_delay_ms(uint32_t ms);
sys_sem_t* sys_thread_sem_init(void);
void sys_thread_sem_deinit(void);
#include <sys/time.h>
#include <sys/fcntl.h>
#include "esp_task.h"
+#include "esp_system.h"
#include "sdkconfig.h"
/* Enable all Espressif-only options */
*/
#define SMEMCPY(dst,src,len) memcpy(dst,src,len)
-#define LWIP_RAND rand
+#define LWIP_RAND esp_random
/*
------------------------------------