diff options
author | Uros Majstorovic <majstor@majstor.org> | 2017-12-06 07:17:24 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2017-12-06 07:17:24 +0100 |
commit | 848f44266dd4b9213af632d55747d66f03881422 (patch) | |
tree | 2f1a348e6e5c77760bbbec8d2ec54e89cedc7e66 /code/core/rbuf.c | |
parent | 028af540a2d856bccc84d3f5e3e8d3517105e411 (diff) |
refactoring for memory limited systems
Diffstat (limited to 'code/core/rbuf.c')
-rw-r--r-- | code/core/rbuf.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/code/core/rbuf.c b/code/core/rbuf.c index 67c9f8d..b5f66a9 100644 --- a/code/core/rbuf.c +++ b/code/core/rbuf.c @@ -44,8 +44,7 @@ ssize_t ecp_rbuf_msg_store(ECPRBuffer *rbuf, ecp_seq_t seq, int idx, unsigned ch return msg_size; } -ssize_t ecp_rbuf_pld_send(ECPConnection *conn, unsigned char *payload, size_t payload_size, ecp_seq_t seq) { - unsigned char packet[ECP_MAX_PKT]; +ssize_t ecp_rbuf_pld_send(ECPConnection *conn, ECPBuffer *packet, ECPBuffer *payload, size_t pld_size, ecp_seq_t seq) { ECPSocket *sock = conn->sock; ECPContext *ctx = sock->ctx; ECPNetAddr addr; @@ -59,10 +58,10 @@ ssize_t ecp_rbuf_pld_send(ECPConnection *conn, unsigned char *payload, size_t pa seq_item.seq_w = 1; seq_item.rb_pass = 1; - rv = ctx->pack(conn, packet, ECP_MAX_PKT, ECP_ECDH_IDX_INV, ECP_ECDH_IDX_INV, payload, payload_size, &seq_item, &addr); + rv = ctx->pack(conn, packet, ECP_ECDH_IDX_INV, ECP_ECDH_IDX_INV, payload, pld_size, &seq_item, &addr); if (rv < 0) return rv; - rv = ecp_pkt_send(sock, &addr, packet, rv); + rv = ecp_pkt_send(sock, &addr, packet->buffer, rv); if (rv < 0) return rv; return rv; |