Each connection has a
flags bit field. Some flags are set by Mongoose, for
example if a user creates an outbound UDP connection using a
address, Mongoose is going to set a
MG_F_UDP flag for that connection. Other
flags are meant to be set only by the user event handler to tell Mongoose how to
behave. Below is a list of connection flags that are meant to be set by event
MG_F_SEND_AND_CLOSEtells Mongoose that all data has been appended to the
send_mbuf. As soon as Mongoose sends it to the socket, the connection will be closed.
MG_F_BUFFER_BUT_DONT_SENDtells Mongoose to append data to the
send_mbufbut hold on sending it, because the data will be modified later and then will be sent by clearing the
MG_F_CLOSE_IMMEDIATELYtells Mongoose to close the connection immediately, usually after an error.
MG_F_USER_4could be used by a developer to store an application-specific state.
Flags below are set by Mongoose:
MG_F_SSL_HANDSHAKE_DONESSL only, set when SSL handshake is done.
MG_F_CONNECTINGset when the connection is in connecting state after
mg_connect()call but connect did not finish yet.
MG_F_LISTENINGset for all listening connections.
MG_F_UDPset if the connection is UDP.
MG_F_IS_WEBSOCKETset if the connection is a WebSocket connection.
MG_F_WEBSOCKET_NO_DEFRAGshould be set by a user if the user wants to switch off automatic WebSocket frame defragmentation.