[Twisted-Python] mktap dns is broken if you switch subnets

Tommi Virtanen tv at twistedmatrix.com
Wed Apr 30 15:14:06 EDT 2003

On Wed, Apr 30, 2003 at 02:43:57PM -0400, Jp Calderone wrote:
>   It would be great if Twisted could speak FAM.  I looked briefly at
> integrating the python wrapper, but didn't have time to go very in-depth. 

	Well, it'll need a secondary mechanism anyway, as FAM
	is far from portable.

	Besides, FAM is a daemon. The actual kernel interface
	it uses is called "dnotify", and it goes like this:

fd = open(".", O_RDONLY);
fcntl(fd, F_SETSIG, SIGRTMIN);

	and you'll get an SIGRTMIN every time the dir changes. Allocating
	an available signal sounds like this is something that should first
	be "twistedified", and not used raw.

	This might not even need any C wrapping, or at most exposing
	those DN_* and F_* constants.

	If you really want to use that API, and the DN_* constants
	aren't exported by standard python, it'd be trivial to add
	them to eunuchs. And fall back to statting the file every
	once in a while if eunuchs isn't installed or the kernel
	doesn't understand the fcntl.

> > 	I definitely want this implemented. Please tell what direction
> > 	should I go with the patch, and what do you think is missing
> > 	from "production quality"?
>   It basically looks good.  One thing I'd like done differently is to have
> parseConfig() called at a different time.  Possibly calling it as a result
> of connectionMade() further increases an already large latency on queries. 
> If this were done in a callLater() loop, this would keep the parsing
> overhead out of the path of actual queries the client performs.

	Yeah, sure. I ended up doing it that way just because I couldn't
	remember whether callLaters etc are pickled or not, and make it
	resume from a .tap correctly, etc..

>   As a short term solution, I think this is reasonable (but the point is
> moot if we wrap and use libfam).  How's it sound to you?

	Okay, how about I make it check the file timestamp every n seconds
	via callLater, and commit that? Maybe tomorrow.

:(){ :|:&};:

More information about the Twisted-Python mailing list