Repository navigation
use std.Io.net.IpAddress instead of making our own - #3056
Conversation
|
@codemob-dev I have taken the liberty to switch the inner type. I don't know if there any requirements for the |
|
I think this should be done after #2259, there are some changes in here that are breaking (→changing the location of the question mark) and should be discussed. |
|
Ok. I will then rebase when #2259 is merged. Just for documentation (not to already start the discussion) the change of the question mark was done so I don't need to implement the format function myself again just to put the ? before the port. That's the only reason |
| fn send(self: Socket, data: []const u8, destination: SocketAddress) void { | ||
| const addr = blk: { | ||
| var posixAddr: std.Io.Threaded.PosixAddress = undefined; | ||
| _ = std.Io.Threaded.addressToPosix(&destination.address, &posixAddr); |
There was a problem hiding this comment.
The length (return value) should probably be passed into the other functions instead of using @sizeOf
| isSymmetricNAT = true; | ||
| portString = portString[0 .. portString.len - 1]; | ||
| } | ||
| const port = try (std.fmt.parseUnsigned(u16, portString, 10) catch |err| (defaultPort orelse err)); |
There was a problem hiding this comment.
Instead of ignoring the error when a defaultPort is present, this should only use the default port when the portString.len == 0
IntegratedQuantum
left a comment
There was a problem hiding this comment.
Since the network code is quite attractive to windows issues and you are using new standard library functions, please also find someone to test this on Windows
|
This was tested on the last playsession by a windows user, no problems were reported |
This can be seen as a follow up or replacement for #2259
It is also a preparation for #859 and #2338
The last two commits switched from
Ip4Addressto the generlizedIpAddressso that can be reverted if wanted