Re: [Twisted-Python] Setting socket options before connect

2013-07-19 Thread Mikhail Terekhov
On Thu, Jul 18, 2013 at 1:09 PM, wrote: > On 01:09 pm, p.may...@imperial.ac.uk wrote: > ... > 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 conven

Re: [Twisted-Python] Setting socket options before connect

2013-07-18 Thread exarkun
On 01:09 pm, p.may...@imperial.ac.uk wrote: On 18/07/13 13:10, exar...@twistedmatrix.com wrote: 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 shortcomi

Re: [Twisted-Python] Setting socket options before connect

2013-07-18 Thread Phil Mayers
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'

Re: [Twisted-Python] Setting socket options before connect

2013-07-18 Thread exarkun
On 10:27 am, p.may...@imperial.ac.uk wrote: On 17/07/13 18:44, Glyph wrote: Anyhow, I think this certainly means a ticket should be filed for introducing some API - but it seems that a little more discussion about what the API should be will still be necessary. Agreed. But then, it's been a c

Re: [Twisted-Python] Setting socket options before connect

2013-07-18 Thread Phil Mayers
On 17/07/13 18:44, Glyph wrote: Anyhow, I think this certainly means a ticket should be filed for introducing some API - but it seems that a little more discussion about what the API should be will still be necessary. Agreed. But then, it's been a couple days and nobody else has contributed t

Re: [Twisted-Python] Setting socket options before connect

2013-07-17 Thread Glyph
On Jul 15, 2013, at 4:44 AM, exar...@twistedmatrix.com wrote: > On 01:01 am, gl...@twistedmatrix.com wrote: >> >> On Jul 12, 2013, at 5:09 AM, exar...@twistedmatrix.com wrote: >>> On 10:42 am, p.may...@imperial.ac.uk wrote: On 12/07/13 11:34, Itamar Turner-Trauring wrote: > Subclass twi

Re: [Twisted-Python] Setting socket options before connect

2013-07-15 Thread exarkun
On 01:01 am, gl...@twistedmatrix.com wrote: On Jul 12, 2013, at 5:09 AM, exar...@twistedmatrix.com wrote: On 10:42 am, p.may...@imperial.ac.uk wrote: On 12/07/13 11:34, Itamar Turner-Trauring wrote: Subclass twisted.internet.tcp.Client, override createInternetSocket() so it calls setsockopt(

Re: [Twisted-Python] Setting socket options before connect

2013-07-15 Thread Glyph
On Jul 12, 2013, at 5:09 AM, exar...@twistedmatrix.com wrote: > On 10:42 am, p.may...@imperial.ac.uk wrote: >> On 12/07/13 11:34, Itamar Turner-Trauring wrote: >>> Subclass twisted.internet.tcp.Client, override createInternetSocket() so >>> it calls setsockopt() on the socket after you've called

Re: [Twisted-Python] Setting socket options before connect

2013-07-12 Thread exarkun
On 10:42 am, p.may...@imperial.ac.uk wrote: On 12/07/13 11:34, Itamar Turner-Trauring wrote: Subclass twisted.internet.tcp.Client, override createInternetSocket() so it calls setsockopt() on the socket after you've called base implementation to create it. This breaks some abstraction boundaries

Re: [Twisted-Python] Setting socket options before connect

2013-07-12 Thread Phil Mayers
On 12/07/13 11:34, Itamar Turner-Trauring wrote: Subclass twisted.internet.tcp.Client, override createInternetSocket() so it calls setsockopt() on the socket after you've called base implementation to create it. This breaks some abstraction boundaries, so it isn't great, but very little code dupl

Re: [Twisted-Python] Setting socket options before connect

2013-07-12 Thread Itamar Turner-Trauring
Subclass twisted.internet.tcp.Client, override createInternetSocket() so it calls setsockopt() on the socket after you've called base implementation to create it. This breaks some abstraction boundaries, so it isn't great, but very little code duplication is involved. -- Itamar Turner-Trauring, F

[Twisted-Python] Setting socket options before connect

2013-07-12 Thread Phil Mayers
I have a use case (namely setting the Linux-specific SO_MARK socket option) where I need to set the socket option after the socket object is created but before Twisted starts to try and connect. Is there a clean way to do this? Ideally there would be some sort of pre-connect function, similar