Hello All, I am looking for a little bit of advice for making a new client library for SocketCAN <https://www.kernel.org/doc/Documentation/networking/can.txt>sockets in Linux.
Low level support for SockaddrCAN was just added to /x/sys/unix (https://github.com/golang/go/issues/16188) and now I want to make a nice user level library to make things easier. It is fairly common to require read/write timeouts on the socket, this means that it would be ideal to implement the net.Conn interface with support for Set*Deadline, however I am struggling with the best way to do this. I can see 3 options, and hopefully someone here has some ideas which would be best (or something completely different that I didn't think of). 1. I could just implement all the deadlines myself by using unix.Poll to check for activity on the file descriptor before I do a read/write (basically the old C method). This seems like the easiest, however I am unsure how the go runtime will like it if I have a bunch of goroutines all sitting in unix.Poll system calls, not going through the "netpoller". 2. I could copy out the relevant code from the "net" package, including fd_unix.go <https://golang.org/src/net/fd_unix.go>, fd_poll_runtime.go <https://golang.org/src/net/fd_poll_runtime.go>, fd_mutex.go <https://golang.org/src/net/fd_mutex.go>, and perhaps a few others. This seems like it will quickly take me down the rabbit hole, as the I think I might end up having to copy quite a large portion of the package into my own. 3. I could just fork the net library as an internal dependency and then create a CANConn type inside it. I am currently leaning towards this idea, but I have the nagging suspicion that it is actually a really dumb idea for reasons that I am just too ignorant to know. Anybody have any suggestions? Thanks, Elliot -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.