mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +03:00
Remove async_req based async_recv
This commit is contained in:
parent
d1c7bbd893
commit
00ad0c4a43
@ -310,74 +310,6 @@ struct async_req *async_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* fde event handler for the "recv" syscall
|
||||
* @param[in] ev The event context that sent us here
|
||||
* @param[in] fde The file descriptor event associated with the recv
|
||||
* @param[in] flags Can only be TEVENT_FD_READ here
|
||||
* @param[in] priv private data, "struct async_req *" in this case
|
||||
*/
|
||||
|
||||
static void async_recv_callback(struct tevent_context *ev,
|
||||
struct tevent_fd *fde, uint16_t flags,
|
||||
void *priv)
|
||||
{
|
||||
struct async_req *req = talloc_get_type_abort(
|
||||
priv, struct async_req);
|
||||
struct async_syscall_state *state = talloc_get_type_abort(
|
||||
req->private_data, struct async_syscall_state);
|
||||
struct param_recv *p = &state->param.param_recv;
|
||||
|
||||
if (state->syscall_type != ASYNC_SYSCALL_RECV) {
|
||||
async_req_error(req, EIO);
|
||||
return;
|
||||
}
|
||||
|
||||
state->result.result_ssize_t = recv(p->fd, p->buffer, p->length,
|
||||
p->flags);
|
||||
state->sys_errno = errno;
|
||||
|
||||
TALLOC_FREE(state->fde);
|
||||
|
||||
async_req_done(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* Async version of recv(2)
|
||||
* @param[in] mem_ctx The memory context to hang the result off
|
||||
* @param[in] ev The event context to work from
|
||||
* @param[in] fd The socket to recv from
|
||||
* @param[in] buffer The buffer to recv into
|
||||
* @param[in] length How many bytes to recv
|
||||
* @param[in] flags flags passed to recv(2)
|
||||
*
|
||||
* This function is a direct counterpart of recv(2)
|
||||
*/
|
||||
|
||||
struct async_req *async_recv(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
int fd, void *buffer, size_t length,
|
||||
int flags)
|
||||
{
|
||||
struct async_req *result;
|
||||
struct async_syscall_state *state;
|
||||
|
||||
result = async_fde_syscall_new(
|
||||
mem_ctx, ev, ASYNC_SYSCALL_RECV,
|
||||
fd, TEVENT_FD_READ, async_recv_callback,
|
||||
&state);
|
||||
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
state->param.param_recv.fd = fd;
|
||||
state->param.param_recv.buffer = buffer;
|
||||
state->param.param_recv.length = length;
|
||||
state->param.param_recv.flags = flags;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
struct async_send_state {
|
||||
int fd;
|
||||
const void *buf;
|
||||
|
@ -32,9 +32,6 @@ int async_syscall_result_int(struct async_req *req, int *perrno);
|
||||
struct async_req *async_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
int fd, const void *buffer, size_t length,
|
||||
int flags);
|
||||
struct async_req *async_recv(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
|
||||
int fd, void *buffer, size_t length,
|
||||
int flags);
|
||||
|
||||
struct tevent_req *async_send_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
|
Loading…
x
Reference in New Issue
Block a user