x/os, x/tcp: fix Socket.Message init values and tcp test buf len

This commit is contained in:
lithdew 2021-05-14 15:42:22 +09:00 committed by Kenta Iwasaki
parent 494665e408
commit 12650bcda4
2 changed files with 4 additions and 4 deletions

View File

@ -405,14 +405,14 @@ test "tcp/client: read and write multiple vectors" {
Buffer.from(message[message.len / 2 ..]),
}), 0);
var buf: [message.len]u8 = undefined;
var buf: [message.len + 1]u8 = undefined;
var msg = Socket.Message.fromBuffers(&[_]Buffer{
Buffer.from(buf[0 .. message.len / 2]),
Buffer.from(buf[message.len / 2 ..]),
});
_ = try client.readVectorized(&msg, 0);
try testing.expectEqualStrings(message, &buf);
try testing.expectEqualStrings(message, buf[0..message.len]);
}
test "tcp/listener: bind to unspecified ipv4 address" {

View File

@ -212,9 +212,9 @@ pub const Socket = struct {
name_len: c_uint = 0,
buffers: usize = undefined,
buffers_len: c_int,
buffers_len: c_int = undefined,
control: usize = null,
control: usize = @ptrToInt(@as(?[*]u8, null)),
control_len: c_uint = 0,
flags: c_int = 0,