Improve struct packing.

This commit is contained in:
Roger A. Light 2020-12-10 12:52:11 +00:00
parent 37ce51703f
commit 757902bcf8
4 changed files with 10 additions and 5 deletions

View File

@ -215,6 +215,7 @@ struct mosquitto {
#ifndef WITH_BROKER
mosq_sock_t sockpairR, sockpairW;
#endif
uint32_t maximum_packet_size;
#if defined(__GLIBC__) && defined(WITH_ADNS)
struct gaicb *adns; /* For getaddrinfo_a */
#endif
@ -236,7 +237,6 @@ struct mosquitto {
struct mosquitto__alias *aliases;
struct will_delay_list *will_delay_entry;
int alias_count;
uint32_t maximum_packet_size;
uint32_t will_delay_interval;
time_t will_delay_time;
#ifdef WITH_TLS
@ -274,8 +274,8 @@ struct mosquitto {
pthread_t thread_id;
#endif
bool clean_start;
uint32_t session_expiry_interval;
time_t session_expiry_time;
uint32_t session_expiry_interval;
#ifdef WITH_BROKER
bool removed_from_by_id; /* True if removed from by_id hash */
bool is_dropping;
@ -291,7 +291,9 @@ struct mosquitto {
char *auth_method;
int sub_count;
int shared_sub_count;
# ifndef WITH_EPOLL
int pollfd_index;
# endif
# ifdef WITH_WEBSOCKETS
struct lws *wsi;
# endif

View File

@ -42,8 +42,9 @@ struct mosquitto *context__init(mosq_sock_t sock)
#ifdef WITH_EPOLL
context->ident = id_client;
#endif
#else
context->pollfd_index = -1;
#endif
mosquitto__set_state(context, mosq_cs_new);
context->sock = sock;
context->last_msg_in = db.now_s;

View File

@ -241,8 +241,8 @@ struct mosquitto__listener_sock{
/* This *must* be the first element in the struct. */
int ident;
#endif
struct mosquitto__listener *listener;
mosq_sock_t sock;
struct mosquitto__listener *listener;
};
typedef struct mosquitto_plugin_id_t{
@ -372,11 +372,11 @@ struct mosquitto_msg_store{
void *payload;
time_t message_expiry_time;
uint32_t payloadlen;
enum mosquitto_msg_origin origin;
uint16_t source_mid;
uint16_t mid;
uint8_t qos;
bool retain;
enum mosquitto_msg_origin origin;
};
struct mosquitto_client_msg{

View File

@ -188,7 +188,9 @@ static int callback_mqtt(
if(mosq->sock != INVALID_SOCKET){
HASH_DELETE(hh_sock, db.contexts_by_sock, mosq);
mosq->sock = INVALID_SOCKET;
#ifndef WITH_EPOLL
mosq->pollfd_index = -1;
#endif
mux__delete(mosq);
}
mosq->wsi = NULL;