cleahcim / go9p

Automatically exported from code.google.com/p/go9p
Other
0 stars 0 forks source link

No API to close the socket associated with a server #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Thanks for go9p! I used it to rewrite a 9p server I had written in C, and 
srv.File made it super-easy.

Unless I've missed something though, there's no way to tell the server to stop 
listening and close the socket. I can understand why as many servers will be 
happy to let the OS clean up the tcp socket after it exits.

However when using unix domain sockets, the OS doesn't clean up the socket file 
and the server fails next time it runs ("address already in use").

It looks like the "go way" here is for the server to call Close() on the unix 
socket once it is done. Go's net library will then take care of removing the 
socket file.

My intention is to add a Stop() call to srv.Srv to facilitate this use case. Is 
there anything I should keep in mind when working on the patch to improve it's 
chance of being accepted?

Thanks,
-sqweek

Original issue reported on code.google.com by sqw...@gmail.com on 27 Nov 2013 at 1:43

GoogleCodeExporter commented 9 years ago
Nevermind! When I finally got into the details I realised it's the net.Listener 
you nede to Close() for go to cleanup a unix socket, and go9p already allows 
you to pass a net.Listener into srv.StartListener.

So this can already be achieved, and adding a Stop call makes no sense after 
all. Apparently I'm not able to close the issue myself -- apologies for the 
noise.

Original comment by sqw...@gmail.com on 16 Jan 2014 at 3:50

GoogleCodeExporter commented 9 years ago
ok, glad it's working for you "as-is"

Original comment by mirtchov...@gmail.com on 16 Jan 2014 at 3:54