| ... | @@ -904,10 +904,18 @@ pub const IncomingMessage = struct { | ... | @@ -904,10 +904,18 @@ pub const IncomingMessage = struct { |
| 904 | data: []u8, | 904 | data: []u8, |
| 905 | /// Supplied by caller before calling receive functions; mutated by receive | 905 | /// Supplied by caller before calling receive functions; mutated by receive |
| 906 | /// functions. | 906 | /// functions. |
| 907 | control: []u8 = &.{}, | 907 | control: []u8, |
| 908 | /// Populated by receive functions. | 908 | /// Populated by receive functions. |
| 909 | flags: Flags, | 909 | flags: Flags, |
| 910 | | 910 | |
| | 911 | /// Useful for initializing before calling `receiveManyTimeout`. |
| | 912 | pub const init: IncomingMessage = .{ |
| | 913 | .from = undefined, |
| | 914 | .data = undefined, |
| | 915 | .control = &.{}, |
| | 916 | .flags = undefined, |
| | 917 | }; |
| | 918 | |
| 911 | pub const Flags = packed struct(u8) { | 919 | pub const Flags = packed struct(u8) { |
| 912 | /// indicates end-of-record; the data returned completed a record | 920 | /// indicates end-of-record; the data returned completed a record |
| 913 | /// (generally used with sockets of type SOCK_SEQPACKET). | 921 | /// (generally used with sockets of type SOCK_SEQPACKET). |
| ... | @@ -1146,6 +1154,8 @@ pub const Socket = struct { | ... | @@ -1146,6 +1154,8 @@ pub const Socket = struct { |
| 1146 | pub fn receiveManyTimeout( | 1154 | pub fn receiveManyTimeout( |
| 1147 | s: *const Socket, | 1155 | s: *const Socket, |
| 1148 | io: Io, | 1156 | io: Io, |
| | 1157 | /// Function assumes each element has initialized `control` field. |
| | 1158 | /// Initializing with `IncomingMessage.init` may be helpful. |
| 1149 | message_buffer: []IncomingMessage, | 1159 | message_buffer: []IncomingMessage, |
| 1150 | data_buffer: []u8, | 1160 | data_buffer: []u8, |
| 1151 | flags: ReceiveFlags, | 1161 | flags: ReceiveFlags, |