mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-01 05:52:32 +07:00
Comments in headers are changed a bit: removed adoc-specific stuff, markdown is used instead PUBLISHED_FROM=9242cce85cc52a47a197d377e7e23804721a6bb5
1.5 KiB
1.5 KiB
title
| title |
|---|
| Connection flags |
Each connection has a flags bit field. Some flags are set by Mongoose, for
example if a user creates an outbound UDP connection using udp://1.2.3.4:5678
address, Mongoose is going to set MG_F_UDP flag for that connection. Other
flags are meant to be set only by user event handler to tell Mongoose how to
behave. Below is a list of connection flags that are meant to be set by event
handlers:
MG_F_FINISHED_SENDING_DATAtells Mongoose that all data has been appended to thesend_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 thesend_mbufbut hold on sending it, because the data will be modified later and then will be sent by clearingMG_F_BUFFER_BUT_DONT_SENDflag.MG_F_CLOSE_IMMEDIATELYtells Mongoose to close the connection immediately, usually after some errorMG_F_USER_1,MG_F_USER_2,MG_F_USER_3,MG_F_USER_4could be used by a developer to store 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 connection is in connecting state aftermg_connect()call but connect did not finish yet.MG_F_LISTENINGset for all listening connectionsMG_F_UDPset if connection is UDPMG_F_IS_WEBSOCKETset if connection is a Websocket connectionMG_F_WEBSOCKET_NO_DEFRAGshould be set by a user if user wants to switch off automatic Websocket frame defragmentation