SocketStream: add support for unix domain sockets #100

Merged
merged 1 commit into from Nov 26, 2012

Projects

None yet

2 participants

@alonho
alonho commented Nov 25, 2012

Added client, server and a test.

The server code isn't very pretty as it was highly oriented to networking. I didn't want to make a bigger refactoring as it won't be backward compatible (and I'd be happy to see it in 3.2).

It'd be perfectly fine if you decide not to merge.. I can offer a prettier solution to 3.3 (specifically add separate constructors to the Server class instead of tons of mutually exclusive arguments)

@tomerfiliba tomerfiliba merged commit ebc0bbd into tomerfiliba:LTS3.2 Nov 26, 2012

1 check passed

default The Travis build passed
Details
@tomerfiliba
Owner

i'm going to release 3.2.3 next week so i incorporated it despite my reservations. on the other hand, i don't want to break backwards compatibility for the 3.2 branch, so i decided to live with it. for 3.3 i'll prolly rewrite it.

also, 👎 for testing if ipv6 != False :-)

thanks!

@alonho
alonho commented Nov 27, 2012

you're right about the ipv6. I was in the mood of comparing all values to their defaults for some reason.

I wonder what are your thoughts about function arguments default values. I usually set them to None always. that way I can always compare to None to see if a user has set a value, and even more important factory functions that just call the same function don't need to copy it's return values.

then again, if it was easy to extract defaults it could be a different ball game:
imagine the following for testing if a value is set: if ipv6 == current_func.defaults.ipv6. (basically a better interface for func.func_defaults)
and for passing along defaults: def factory_function(ipv6=orig_function.defaults.ipv6)

@tomerfiliba
Owner

go ahead and send a patch to python :)

i'm all for factory methods. i wanted to add bind_tcp(host, port, ...)
and bind_unixdomain(path, ...), but that would break old code. i might
do that for 3.3.
on the other hand, we've only had one "kind" of server till now, so it was
silly to force everyone to use ThreadedServer.bind_tcp(...) instead of
just ThreadedServer(...)

-tomer


Tomer Filiba
tomerfiliba.com http://www.facebook.com/tomerfiliba
http://il.linkedin.com/in/tomerfiliba

On Tue, Nov 27, 2012 at 12:50 PM, Alon Horev notifications@github.comwrote:

factory_function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment