diff options
author | Uros Majstorovic <majstor@majstor.org> | 2024-05-11 15:58:48 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2024-05-11 15:58:48 +0200 |
commit | 7a0e44998f426752c58975ae686d8e88aa131195 (patch) | |
tree | b410237e4d9986a06108e9c0beff015a97effc55 /ecp/src/platform/fe310 | |
parent | b3c62e6acc5761171822f522dc9d784558f9afbe (diff) |
added error handler per connection type; improved handlers API and error reporting
Diffstat (limited to 'ecp/src/platform/fe310')
-rw-r--r-- | ecp/src/platform/fe310/transport.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ecp/src/platform/fe310/transport.c b/ecp/src/platform/fe310/transport.c index bc758c9..35addfa 100644 --- a/ecp/src/platform/fe310/transport.c +++ b/ecp/src/platform/fe310/transport.c @@ -66,11 +66,12 @@ int ecp_tr_addr_set(ecp_tr_addr_t *addr, void *addr_s) { } int ecp_tr_open(ECPSocket *sock, ecp_tr_addr_t *addr) { - sock->sock = eos_sock_open_udp(packet_handler, NULL); - if (sock->sock < 0) { - sock->sock = 0; - return ECP_ERR; - } + int rv; + + rv = eos_sock_open_udp(packet_handler, NULL); + if (rv < 0) return ECP_ERR_OPEN; + + sock->sock = rv; _ecp_tr_sock = sock; return ECP_OK; @@ -97,7 +98,7 @@ ssize_t ecp_tr_send(ECPSocket *sock, ECPBuffer *packet, size_t pkt_size, ecp_tr_ } else { buf = eos_net_alloc(); } - if (buf == NULL) return ECP_ERR; + if (buf == NULL) return ECP_ERR_ALLOC; rv = eos_sock_sendto_async(sock->sock, reply ? NULL : packet->buffer, pkt_size, addr, buf, !!(flags & ECP_SEND_FLAG_MORE)); if (rv) return ECP_ERR_SEND; |