#include <grpc/support/port_platform.h>
#include "src/core/lib/surface/server.h"
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <atomic>
#include <list>
#include <new>
#include <queue>
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "absl/status/status.h"
#include "absl/types/optional.h"
#include <grpc/byte_buffer.h>
#include <grpc/impl/codegen/connectivity_state.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_args_preconditioning.h"
#include "src/core/lib/channel/channel_trace.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/config/core_configuration.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/mpscq.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/pollset_set.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_refcount.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/channel_stack_type.h"
#include "src/core/lib/surface/completion_queue.h"
#include "src/core/lib/transport/connectivity_state.h"
#include "src/core/lib/transport/error_utils.h"
Go to the source code of this file.
Namespaces | |
grpc_core | |
Variables | |
TraceFlag | grpc_core::grpc_server_channel_trace (false, "server_channel") |
void grpc_server_cancel_all_calls | ( | grpc_server * | server | ) |
Cancel all in-progress calls. Only usable after shutdown.
Definition at line 1512 of file src/core/lib/surface/server.cc.
void grpc_server_config_fetcher_destroy | ( | grpc_server_config_fetcher * | config_fetcher | ) |
EXPERIMENTAL. Destroys a config fetcher.
Definition at line 1581 of file src/core/lib/surface/server.cc.
grpc_server* grpc_server_create | ( | const grpc_channel_args * | args, |
void * | reserved | ||
) |
Create a server. Additional configuration for each incoming channel can be specified with args. If no additional configuration is needed, args can be NULL. The user data in 'args' need only live through the invocation of this function. However, if any args of the 'pointer' type are passed, then the referenced vtable must be maintained by the caller until grpc_server_destroy terminates. See grpc_channel_args definition for more on this.
Definition at line 1456 of file src/core/lib/surface/server.cc.
void grpc_server_destroy | ( | grpc_server * | server | ) |
Destroy a server. Shutdown must have completed beforehand (i.e. all tags generated by grpc_server_shutdown_and_notify must have been received, and at least one call to grpc_server_shutdown_and_notify must have been made).
Definition at line 1519 of file src/core/lib/surface/server.cc.
void grpc_server_register_completion_queue | ( | grpc_server * | server, |
grpc_completion_queue * | cq, | ||
void * | reserved | ||
) |
Register a completion queue with the server. Must be done for any notification completion queue that is passed to grpc_server_request_*_call and to grpc_server_shutdown_and_notify. Must be performed prior to grpc_server_start.
Definition at line 1466 of file src/core/lib/surface/server.cc.
void* grpc_server_register_method | ( | grpc_server * | server, |
const char * | method, | ||
const char * | host, | ||
grpc_server_register_method_payload_handling | payload_handling, | ||
uint32_t | flags | ||
) |
Registers a method in the server. Methods to this (host, method) pair will not be reported by grpc_server_request_call, but instead be reported by grpc_server_request_registered_call when passed the appropriate registered_method (as returned by this function). Must be called before grpc_server_start. Returns NULL on failure.
Definition at line 1485 of file src/core/lib/surface/server.cc.
grpc_call_error grpc_server_request_call | ( | grpc_server * | server, |
grpc_call ** | call, | ||
grpc_call_details * | details, | ||
grpc_metadata_array * | request_metadata, | ||
grpc_completion_queue * | cq_bound_to_call, | ||
grpc_completion_queue * | cq_for_notification, | ||
void * | tag_new | ||
) |
Request notification of a new call. Once a call is received, a notification tagged with tag_new is added to cq_for_notification. call, details and request_metadata are updated with the appropriate call information. cq_bound_to_call is bound to call, and batch operation notifications for that call will be posted to cq_bound_to_call. Note that cq_for_notification must have been registered to the server via grpc_server_register_completion_queue.
Definition at line 1526 of file src/core/lib/surface/server.cc.
grpc_call_error grpc_server_request_registered_call | ( | grpc_server * | server, |
void * | registered_method, | ||
grpc_call ** | call, | ||
gpr_timespec * | deadline, | ||
grpc_metadata_array * | request_metadata, | ||
grpc_byte_buffer ** | optional_payload, | ||
grpc_completion_queue * | cq_bound_to_call, | ||
grpc_completion_queue * | cq_for_notification, | ||
void * | tag_new | ||
) |
Request notification of a new pre-registered call. 'cq_for_notification' must have been registered to the server via grpc_server_register_completion_queue.
Definition at line 1546 of file src/core/lib/surface/server.cc.
void grpc_server_set_config_fetcher | ( | grpc_server * | server, |
grpc_server_config_fetcher * | config_fetcher | ||
) |
EXPERIMENTAL. Sets the server's config fetcher. Takes ownership. Must be called before adding ports
Definition at line 1571 of file src/core/lib/surface/server.cc.
void grpc_server_shutdown_and_notify | ( | grpc_server * | server, |
grpc_completion_queue * | cq, | ||
void * | tag | ||
) |
Begin shutting down a server. After completion, no new calls or connections will be admitted. Existing calls will be allowed to complete. Send a GRPC_OP_COMPLETE event when there are no more calls being serviced. Shutdown is idempotent, and all tags will be notified at once if multiple grpc_server_shutdown_and_notify calls are made. 'cq' must have been registered to this server via grpc_server_register_completion_queue.
Definition at line 1503 of file src/core/lib/surface/server.cc.
void grpc_server_start | ( | grpc_server * | server | ) |
Start a server - tells all listeners to start listening
Definition at line 1497 of file src/core/lib/surface/server.cc.
|
private |
Definition at line 496 of file src/core/lib/surface/server.cc.
Definition at line 466 of file src/core/lib/surface/server.cc.
grpc_slice slice |
Definition at line 467 of file src/core/lib/surface/server.cc.