jiridanek commented on a change in pull request #744: URL: https://github.com/apache/qpid-dispatch/pull/744#discussion_r432864389
########## File path: src/server.c ########## @@ -17,1657 +17,609 @@ * under the License. */ -#include "python_private.h" // must be first! -#include "dispatch_private.h" -#include <qpid/dispatch/python_embedded.h> - -#include <qpid/dispatch/ctools.h> -#include <qpid/dispatch/threading.h> -#include <qpid/dispatch/log.h> -#include <qpid/dispatch/amqp.h> -#include <qpid/dispatch/server.h> -#include <qpid/dispatch/failoverlist.h> -#include <qpid/dispatch/alloc.h> -#include <qpid/dispatch/platform.h> +// This must be first to work around a Python bug +// +// clang-format off +#include "python_private.h" +// clang-format on +#include <errno.h> +#include <inttypes.h> +#include <proton/condition.h> #include <proton/event.h> #include <proton/listener.h> #include <proton/netaddr.h> #include <proton/proactor.h> #include <proton/sasl.h> +#include <qpid/dispatch/alloc.h> +#include <qpid/dispatch/amqp.h> +#include <qpid/dispatch/ctools.h> +#include <qpid/dispatch/failoverlist.h> +#include <qpid/dispatch/log.h> +#include <qpid/dispatch/platform.h> +#include <qpid/dispatch/python_embedded.h> +#include <qpid/dispatch/server.h> +#include <qpid/dispatch/threading.h> +#include <stdio.h> +#include <string.h> - +#include "config.h" +#include "connection.h" +#include "connector.h" +#include "dispatch_private.h" #include "entity.h" #include "entity_cache.h" -#include "dispatch_private.h" +#include "listener.h" #include "policy.h" +#include "remote_sasl.h" #include "server_private.h" #include "timer_private.h" -#include "config.h" -#include "remote_sasl.h" -#include <stdio.h> -#include <string.h> -#include <errno.h> -#include <inttypes.h> - -struct qd_server_t { - qd_dispatch_t *qd; - const int thread_count; /* Immutable */ - const char *container_name; - const char *sasl_config_path; - const char *sasl_config_name; - pn_proactor_t *proactor; - qd_container_t *container; - qd_log_source_t *log_source; - qd_log_source_t *protocol_log_source; // Log source for the PROTOCOL module - void *start_context; - sys_cond_t *cond; - sys_mutex_t *lock; - qd_connection_list_t conn_list; - int pause_requests; - int threads_paused; - int pause_next_sequence; - int pause_now_serving; - uint64_t next_connection_id; - void *py_displayname_obj; - qd_http_server_t *http; - sys_mutex_t *conn_activation_lock; -}; #define HEARTBEAT_INTERVAL 1000 -ALLOC_DEFINE(qd_listener_t); -ALLOC_DEFINE(qd_connector_t); ALLOC_DEFINE(qd_deferred_call_t); -ALLOC_DEFINE(qd_connection_t); - -const char *MECH_EXTERNAL = "EXTERNAL"; - -//Allowed uidFormat fields. -const char CERT_COUNTRY_CODE = 'c'; -const char CERT_STATE = 's'; -const char CERT_CITY_LOCALITY = 'l'; -const char CERT_ORGANIZATION_NAME = 'o'; -const char CERT_ORGANIZATION_UNIT = 'u'; -const char CERT_COMMON_NAME = 'n'; -const char CERT_FINGERPRINT_SHA1 = '1'; -const char CERT_FINGERPRINT_SHA256 = '2'; -const char CERT_FINGERPRINT_SHA512 = '5'; -char *COMPONENT_SEPARATOR = ";"; - -static const int BACKLOG = 50; /* Listening backlog */ - -static void setup_ssl_sasl_and_open(qd_connection_t *ctx); -static qd_failover_item_t *qd_connector_get_conn_info(qd_connector_t *ct); - -/** - * This function is set as the pn_transport->tracer and is invoked when proton tries to write the log message to pn_transport->tracer - */ -void transport_tracer(pn_transport_t *transport, const char *message) -{ - qd_connection_t *ctx = (qd_connection_t*) pn_transport_get_context(transport); - if (ctx) { - // The PROTOCOL module is used exclusively for logging protocol related tracing. The protocol could be AMQP, HTTP, TCP etc. - qd_log(ctx->server->protocol_log_source, QD_LOG_TRACE, "[%"PRIu64"]:%s", ctx->connection_id, message); - } -} - -void connection_transport_tracer(pn_transport_t *transport, const char *message) -{ - qd_connection_t *ctx = (qd_connection_t*) pn_transport_get_context(transport); - if (ctx) { - // Unconditionally write the log at TRACE level to the log file. - qd_log_impl_v1(ctx->server->protocol_log_source, QD_LOG_TRACE, __FILE__, __LINE__, "[%"PRIu64"]:%s", ctx->connection_id, message); - } -} -/** - * Save displayNameService object instance and ImportModule address - * Called with qd_python_lock held - */ -qd_error_t qd_register_display_name_service(qd_dispatch_t *qd, void *displaynameservice) -{ +// Save displayNameService object instance and ImportModule address. +// Called with qd_python_lock held. +// +// XXX But it doesn't use the _lh convention? +qd_error_t qd_register_display_name_service(qd_dispatch_t* qd, void* displaynameservice) { Review comment: Previously the doc blocks were formatted as [doxygen comment blocks](https://www.doxygen.nl/manual/docblocks.html), while the new comments aren't. Is that a plan? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org