| 75 | } |
| 76 | |
| 77 | static enum rym_code _rym_recv_data( |
| 78 | struct rym_ctx *ctx, |
| 79 | rt_uint8_t *buf, |
| 80 | rt_size_t len) |
| 81 | { |
| 82 | struct custom_ctx *cctx = (struct custom_ctx *)ctx; |
| 83 | |
| 84 | RT_ASSERT(cctx->fd >= 0); |
| 85 | if (cctx->flen == -1) |
| 86 | { |
| 87 | write(cctx->fd, buf, len); |
| 88 | } |
| 89 | else |
| 90 | { |
| 91 | int wlen = len > cctx->flen ? cctx->flen : len; |
| 92 | write(cctx->fd, buf, wlen); |
| 93 | cctx->flen -= wlen; |
| 94 | } |
| 95 | |
| 96 | return RYM_CODE_ACK; |
| 97 | } |
| 98 | |
| 99 | static enum rym_code _rym_recv_end( |
| 100 | struct rym_ctx *ctx, |