bugfixes & use new lwip mempool for FreeRTOS lwip

This commit is contained in:
2022-05-29 17:34:43 +02:00
parent d34effb278
commit ff569dd02c
10 changed files with 162 additions and 163 deletions

View File

@ -17,7 +17,7 @@ TmTcLwIpUdpBridge::TmTcLwIpUdpBridge(object_id_t objectId,
TmTcLwIpUdpBridge::lastAdd.addr = IPADDR_TYPE_ANY;
}
TmTcLwIpUdpBridge::~TmTcLwIpUdpBridge() {}
TmTcLwIpUdpBridge::~TmTcLwIpUdpBridge() = default;
ReturnValue_t TmTcLwIpUdpBridge::initialize() {
TmTcBridge::initialize();
@ -29,11 +29,12 @@ ReturnValue_t TmTcLwIpUdpBridge::initialize() {
return result;
}
ReturnValue_t TmTcLwIpUdpBridge::udp_server_init(void) {
ReturnValue_t TmTcLwIpUdpBridge::udp_server_init() {
err_t err;
/* Create a new UDP control block */
TmTcLwIpUdpBridge::upcb = udp_new();
if (TmTcLwIpUdpBridge::upcb) {
sif::printInfo("Opening UDP server on port %d\n", UDP_SERVER_PORT);
/* Bind the upcb to the UDP_PORT port */
/* Using IP_ADDR_ANY allow the upcb to be used by any local interface */
err = udp_bind(TmTcLwIpUdpBridge::upcb, IP_ADDR_ANY, UDP_SERVER_PORT);
@ -120,7 +121,6 @@ void TmTcLwIpUdpBridge::udp_server_receive_callback(void *arg,
struct pbuf *p,
const ip_addr_t *addr,
u16_t port) {
struct pbuf *p_tx = nullptr;
auto udpBridge = reinterpret_cast<TmTcLwIpUdpBridge *>(arg);
if (udpBridge == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -133,9 +133,9 @@ void TmTcLwIpUdpBridge::udp_server_receive_callback(void *arg,
#endif
}
/* allocate pbuf from RAM*/
p_tx = pbuf_alloc(PBUF_TRANSPORT, p->len, PBUF_RAM);
struct pbuf *p_tx = pbuf_alloc(PBUF_TRANSPORT, p->len, PBUF_RAM);
if (p_tx != NULL) {
if (p_tx != nullptr) {
if (udpBridge != nullptr) {
MutexGuard lg(udpBridge->bridgeLock);
udpBridge->upcb = upcb_;