@@ -24,10 +24,25 @@ typedef struct {
2424 int dummy ;
2525} tcp_socket_state_bound_t ;
2626typedef struct {
27+ #ifdef __wasip2__
2728 int dummy ;
29+ #else
30+ // Arguments, results, and subtask connected to `[method]tcp-socket.connect`
31+ // while it's in-progress. Note that `subtask` may be 0 in which case it means
32+ // that `result` is valid as it's been filled in.
33+ sockets_method_tcp_socket_connect_args_t args ;
34+ sockets_result_void_error_code_t result ;
35+ wasip3_subtask_t subtask ;
36+ #endif
2837} tcp_socket_state_connecting_t ;
2938typedef struct {
39+ #ifdef __wasip2__
3040 int dummy ;
41+ #else
42+ // The `stream<tcp-socket>` that this is reading to receive accepted sockets.
43+ sockets_stream_own_tcp_socket_t stream ;
44+ bool done ;
45+ #endif
3146} tcp_socket_state_listening_t ;
3247
3348// Pollables here are lazily initialized on-demand.
@@ -38,7 +53,19 @@ typedef struct {
3853 streams_own_output_stream_t output ;
3954 poll_own_pollable_t output_pollable ;
4055#else
41- int dummy ; // TODO(wasip3)
56+ // The bytes that are being received on this socket in addition to the future
57+ // of the result to read when the socket hits EOF to see if there's an error.
58+ sockets_stream_u8_t receive ;
59+ sockets_future_result_void_error_code_t receive_result ;
60+
61+ // The stream to write to in order to send out bytes, along with the `send`
62+ // subtask that was created connected to the other half of `send`. The
63+ // result of the subtask at `send_result` will get filled in when
64+ // `send_subtask` is finished.
65+ sockets_stream_u8_writer_t send ;
66+ wasip3_subtask_t send_subtask ;
67+ sockets_result_void_error_code_t send_result ;
68+ bool send_done ;
4269#endif
4370} tcp_socket_state_connected_t ;
4471
0 commit comments