summaryrefslogtreecommitdiff
path: root/ecp/src/platform/fe310/transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'ecp/src/platform/fe310/transport.c')
-rw-r--r--ecp/src/platform/fe310/transport.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ecp/src/platform/fe310/transport.c b/ecp/src/platform/fe310/transport.c
index 35addfa..b53534d 100644
--- a/ecp/src/platform/fe310/transport.c
+++ b/ecp/src/platform/fe310/transport.c
@@ -1,6 +1,5 @@
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
#include <ecp/core.h>
#include <ecp/tr.h>
@@ -12,6 +11,7 @@ ECPSocket *_ecp_tr_sock = NULL;
unsigned char pld_buf[ECP_MAX_PLD];
static void packet_handler(unsigned char type, unsigned char *buffer, uint16_t len) {
+ ECPContext *ctx;
ECP2Buffer bufs;
ECPBuffer packet;
ECPBuffer payload;
@@ -33,12 +33,13 @@ static void packet_handler(unsigned char type, unsigned char *buffer, uint16_t l
eos_sock_recvfrom(buffer, len, NULL, 0, &addr);
+ ctx = _ecp_tr_sock->ctx;
rv = ecp_pkt_handle(_ecp_tr_sock, NULL, &addr, &bufs, len-EOS_SOCK_SIZE_UDP_HDR);
-#ifdef ECP_DEBUG
- if (rv < 0) {
- printf("RCV ERR:%d\n", rv);
+ if ((rv < 0) && ctx->logger) {
+ int _rv = rv;
+
+ ctx->logger("packet_handler: err:%d\n", _rv);
}
-#endif
if (bufs.packet->buffer) {
eos_net_free(buffer, 0);
} else {