hugelgupf / p9

Idiomatic Go 9P2000.L client and server, extracted from gVisor for general use
Apache License 2.0
90 stars 19 forks source link

Implement vecnet.ReadFrom on Windows #54

Open djdv opened 2 years ago

djdv commented 2 years ago

This implementation is mostly copied from the Linux version, with types and methods being adjusted for Windows.

I wrote a test which covers this and passes, but I'm not sure how correct it is. The main concern is if the calls to WriteMsgUDP would ever block. If they do, this could just be wrapped in a goroutine. Maybe that happens on larger messages? Maybe the test should send 9P-messages instead of arbitrary []bytes?

Outside of this though, I'm not sure how it compares to the existing io.Read fallback in vecnet.ReadFrom(reader). Both in terms of performance or correctness.

I'll leave this as a draft until it's tested a little better with implementations that use the library across Windows<->Linux machines. As long as they appear to comply and the performance isn't worse, it should be okay I guess?

Edit: I'm getting hangs during Attach sometimes. Maybe it's the opposite of above, small messages don't ever get flushed from the buffers? Not sure but not good enough to be considered stable. (*Could always have been a problem in my server implementation too.)