|
| 1 | +# Messages to Owner Processes |
| 2 | + |
| 3 | +Since most of API calls are asynchronous, the API caller or the stream/connection owner can receive |
| 4 | +async messages as following |
| 5 | + |
| 6 | +## Messages to Stream Owner |
| 7 | + |
| 8 | +### active received data |
| 9 | + |
| 10 | +Data received in binary format |
| 11 | + |
| 12 | +```erlang |
| 13 | +{quic, binary(), stream_handler(), AbsoluteOffset::integer(), TotalBufferLength::integer(), Flag :: integer()} |
| 14 | +``` |
| 15 | + |
| 16 | +### peer_send_shutdown |
| 17 | + |
| 18 | +```erlang |
| 19 | +{quic, peer_send_shutdown, stream_handler(), ErrorCode} |
| 20 | +``` |
| 21 | + |
| 22 | +### peer_send_aborted |
| 23 | + |
| 24 | +```erlang |
| 25 | +{quic, peer_send_aborted, stream_handler(), ErrorCode} |
| 26 | +``` |
| 27 | + |
| 28 | +### stream closed, shutdown_completed, |
| 29 | + |
| 30 | +Both directions of the stream have been shut down. |
| 31 | + |
| 32 | +```erlang |
| 33 | +{quic, closed, stream_handler(), ConnectionShutdown:: 0 | 1} |
| 34 | +``` |
| 35 | + |
| 36 | +### send_complete |
| 37 | + |
| 38 | +Send call is handled by stack, caller is ok to release the sndbuffer |
| 39 | + |
| 40 | +This message is for sync send only. |
| 41 | + |
| 42 | +```erlang |
| 43 | +{quic, send_complete, stream_handler(), IsSendCanceled :: 0 | 1} |
| 44 | +``` |
| 45 | + |
| 46 | + |
| 47 | +### continue recv |
| 48 | + |
| 49 | +This is for passive recv only, this is used to notify |
| 50 | +caller that new data is ready in recv buffer. The data in the recv buffer |
| 51 | +will be pulled by NIF function instead of by sending the erlang messages |
| 52 | + |
| 53 | +see usage in: quicer:recv/2 |
| 54 | + |
| 55 | +``` erlang |
| 56 | +{quic, continue, stream_handler()} |
| 57 | +``` |
| 58 | + |
| 59 | +### passive mode |
| 60 | + |
| 61 | +Running out of *active_n*, stream now is in passive mode. |
| 62 | + |
| 63 | +Need to call setopt active_n to make it back to passive mode again |
| 64 | + |
| 65 | +Or use quicer:recv/2 to receive in passive mode |
| 66 | + |
| 67 | +``` erlang |
| 68 | +{quic, passive, stream_handler()} |
| 69 | +``` |
| 70 | + |
| 71 | +## Messages to Connection Owner |
| 72 | + |
| 73 | +### Connection connected |
| 74 | + |
| 75 | +``` erlang |
| 76 | +{quic, connected, connection_handler()} |
| 77 | +``` |
| 78 | + |
| 79 | +This message notifies the connection owner that quic connection is established(TLS handshake is done). |
| 80 | + |
| 81 | +also see [[Accept New Connection (Server)]] |
| 82 | + |
| 83 | + |
| 84 | +### New Stream Started |
| 85 | + |
| 86 | +``` erlang |
| 87 | +{quic, new_stream, stream_handler()} %% @TODO, it should carry connection_handler() as well |
| 88 | +``` |
| 89 | + |
| 90 | +This message is sent to notify the process which is accpeting new stream. |
| 91 | + |
| 92 | +The process become the owner of the stream. |
| 93 | + |
| 94 | +also see [[Accept Stream (Server)]] |
| 95 | + |
| 96 | +### Transport Shutdown |
| 97 | + |
| 98 | +Connection has been shutdown by the transport locally, such as idle timeout. |
| 99 | + |
| 100 | +``` erlang |
| 101 | +{quic, transport_shutdown, connection_handler(), Status :: atom_status()} |
| 102 | +``` |
| 103 | + |
| 104 | +### Shutdown initiated by PEER |
| 105 | + |
| 106 | +Peer side initiated connection shutdown. |
| 107 | + |
| 108 | +``` erlang |
| 109 | +{quic, shutdown, connection_handler()} |
| 110 | +``` |
| 111 | + |
| 112 | +### Shutdown Complete |
| 113 | + |
| 114 | +The connection has completed the shutdown process and is ready to be |
| 115 | +safely cleaned up. |
| 116 | + |
| 117 | +``` erlang |
| 118 | +{quic, closed, connection_handler()} |
| 119 | +``` |
| 120 | + |
| 121 | +## Messages to Listener Owner |
| 122 | + |
| 123 | +### New connection |
| 124 | + |
| 125 | +``` erlang |
| 126 | +{quic, new_conn, connection_handler()} |
| 127 | +``` |
| 128 | + |
| 129 | +This message is sent to the process who is accepting new connections. |
| 130 | + |
| 131 | +The process becomes the connection owner. |
| 132 | + |
| 133 | +To complete the TLS handshake, quicer:handshake/1,2 should be called. |
| 134 | + |
| 135 | + |
| 136 | + |
0 commit comments