Ejemplo n.º 1
0
static PyObject *py_tevent_req_cancel(TeventReq_Object *self)
{
	if (!tevent_req_cancel(self->req)) {
		PyErr_SetNone(PyExc_RuntimeError);
		return NULL;
	}
	Py_RETURN_NONE;
}
Ejemplo n.º 2
0
static bool smb1cli_trans_cancel(struct tevent_req *req)
{
	struct smb1cli_trans_state *state =
		tevent_req_data(req,
		struct smb1cli_trans_state);

	if (state->primary_subreq == NULL) {
		return false;
	}

	return tevent_req_cancel(state->primary_subreq);
}
Ejemplo n.º 3
0
/*
  send a cancel request
*/
NTSTATUS smb2_cancel(struct smb2_request *r)
{
	bool ok;

	if (r->subreq == NULL) {
		return NT_STATUS_OK;
	}

	ok = tevent_req_cancel(r->subreq);
	if (!ok) {
		return NT_STATUS_INTERNAL_ERROR;
	}

	return NT_STATUS_OK;
}
Ejemplo n.º 4
0
/*
  close the socket and shutdown a server_context
*/
static void ldapsrv_terminate_connection(struct ldapsrv_connection *conn,
					 const char *reason)
{
	struct tevent_req *subreq;

	if (conn->limits.reason) {
		return;
	}

	conn->limits.endtime = timeval_current_ofs(0, 500);

	tevent_queue_stop(conn->sockets.send_queue);
	if (conn->active_call) {
		tevent_req_cancel(conn->active_call);
		conn->active_call = NULL;
	}

	conn->limits.reason = talloc_strdup(conn, reason);
	if (conn->limits.reason == NULL) {
		TALLOC_FREE(conn->sockets.tls);
		TALLOC_FREE(conn->sockets.sasl);
		TALLOC_FREE(conn->sockets.raw);
		stream_terminate_connection(conn->connection, reason);
		return;
	}

	subreq = tstream_disconnect_send(conn,
					 conn->connection->event.ctx,
					 conn->sockets.active);
	if (subreq == NULL) {
		TALLOC_FREE(conn->sockets.tls);
		TALLOC_FREE(conn->sockets.sasl);
		TALLOC_FREE(conn->sockets.raw);
		stream_terminate_connection(conn->connection, reason);
		return;
	}
	tevent_req_set_endtime(subreq,
			       conn->connection->event.ctx,
			       conn->limits.endtime);
	tevent_req_set_callback(subreq, ldapsrv_terminate_connection_done, conn);
}