On 18/07/13 13:10, exar...@twistedmatrix.com wrote:

It wasn't so much an API as a "Hey, I have an idea... endpoints... here
is an example I can think of in 10 seconds." :)

Understood!

I guess it might be ok if there was a way to reliably inject unknown
options with arbitrary payloads, but I'm struggling to see a clean way
to do this with a "parse a string"-style API.

I think you're talking about the fact that "sockopts" are random
integers associated with other big piles of random integers.  Some of
them are flags you turn on, but some come with random payloads of
basically no possible known shape.

Yep.

It sounds like you're trying to think of an API that will support any
and all socket options without understanding them.  This API exists
already.  It is `setsockopt`.  There's no reason to re-invent it.

Sure.

I prefer the approach taken elsewhere in Twisted, where a particular
option is given some consideration and an API that understands the
option is introduced.  This approach certainly has its shortcomings -
for example, it doesn't support arbitrary options. :)  Do people really
like using `setsockopt` though?

No-one "likes" it, but if you need to set a socket option, you don't really have much choice (absent a higher-layer API).

So maybe the correct way to handle this is "implement your own FD
object"?

Nothing stops anyone from doing this already, today.  Except that it's a
lot of work and no one seems to want any of these features badly enough
to do it.

Well, exactly. It's currently easier for me to sub-class a Twisted internal/private class. But if that goes away, that option is unavailable and a replacement would be nice - even if it's a convenience API like:

connectExistingSocket(...)

Isn't there code to do this as part of the systemd activation?

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to