[Twisted-Python] [twisted.mail][newbie] return tempfail (4xx) after eomReceived()

2013-11-23 Thread Fabio Sangiovanni

Hello list,

I'm trying to code an SMTP server that stores received messages in a 
queue (es. RabbitMQ or Redis).
I'm figuring out how to do it with Twisted, and so far I managed to 
print to console the messages the way I want.
I'm trying to understand now how to return a tempfail code (4xx) from 
within eomReceived(), so to simulate (and, in the future, handle) 
temporary unavailabilities of the queuing system, and thus to delegate 
to the client the handling/retrying of the delivery (there will be 
postfix in front of my smtp server, so it will keep the message in its 
spool).
I ended up digging in the code until I found the _messageHandled 
callback of the SMTP class, that's added to the deferred returned by 
eomReceived. I admit I'm not very accustomed to deferreds yet, but I can 
only see 250 and 550 response code inside it. I suspect that I should 
return the 4xx code in one of the deferred's callbacks/errbacks *before* 
_messageHandled, but I really can't imagine how. Would you please give 
me some hints about how to accomplish the task? Am I looking to the 
right direction at all?


Thanks a lot,
Fabio

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


Re: [Twisted-Python] Some thoughts hacking with AMP (was: something about multiplexing and accessing protocols)

2013-11-23 Thread Laurens Van Houtven
On Fri, Nov 22, 2013 at 8:00 PM, Glyph  wrote:

>
> On Nov 22, 2013, at 4:10 AM, Laurens Van Houtven <_...@lvh.io> wrote:
>
> Also, I do really really want the protocol and not the transport. This is
> because I want to pass a reference to the protocol around so that later I
> can call callRemote on it. That I can also get the transport is mostly just
> gravy so that I can return nice things for my fake transport's
> getHost/getPeer.
>
> Except that maybe your protocol is just a BinaryBoxProtocol, and has no
> callRemote method.  Or maybe it's actually HTTP and feeding things to AMP
> after some deserialization pass, like via JSON (aren't you even doing this
> already in some other code?).  Is there even a "protocol" visible to this
> code in that case?
>

Yep and yep:
 - I guess I mean IBoxReceiver? The thing with callRemote on it ;)
 - I'm doing that, and that's what I hope to do again here :)

> - Maybe there should be a new API that passes the proto (and actually
> means "proto" ;))
>
>
> I still think that before providing this new mechanism we need *some* way
> of declaring that we expect more from "the protocol".
>

Yep!


>  I think I have some code up (or will have some code up soon, depending on
> when you read this email) that does have sort-of working multiplexed
> transports:
>
>
> Cool.
>

For what it's worth, I hacked together something in docs/examples that
works. I'll see what I have to do to get it to work over a browser, and see
what I can expose as API :)



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


Re: [Twisted-Python] txThings - simple library for CoAP protocol

2013-11-23 Thread Maciej Wasilak
Ron,

Following with interest.  Seeking a CoAP Python client capability that
> includes:
> - Support for IPV6 to talk directly to server motes in constrained 6LoWPAN
> WSNs. (the large IPV6 address space is for me intrinsic to the IoT concept)
> - Security for the same, so presumably DTLS.
> Both of these needed and particularly security, for any serious monitoring
> and control applications.
>

IPv6 is my target too. In general I've managed to run some tests with
txThings and Contiki powered 6LoWPAN motes. My points below:

1. Twisted doesn't officially support UDP IPv6 yet - however there was
great progress lately - see ticket #5086 (
http://twistedmatrix.com/trac/ticket/5086). Someone else should probably
comment on that, but it seems to be close to the finish line

2. You can easily add unofficial IPv6 support (basic unicast) by modifying
twisted/internet/udp.py. I'll email you the details.

3. There is a problem with txThings IPv6 server, because in most operating
systems source address of datagram is determined in round robin fashion. It
may cause the source address of the response to be different than
destination address of the request. CoAP client drops such responses and
sends RST. I haven't solved the problem yet. However if you need only
client you should be okay for now.

4. DTLS is currently not supported. I agree it's a must for any real life
application. There are some Python DTLS implementations out there, but I
haven't tried to use them with Twisted yet.

5. I don't know of any non-Twisted Python CoAP libraries with full IPv6 and
DTLS support. This week there was CoAP Plugtest event in Las Vegas (ended
yesterday) - when IETF Core working group publishes some report, it might
be a good summary of existing CoAP implementations. According to the first
summary DTLS plugtest had 66% success rate - which means it's a though
topic.

Best regards
Maciej Wasilak
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] [twisted.mail][newbie] return tempfail (4xx) after eomReceived()

2013-11-23 Thread exarkun

On 10:36 am, sangiova...@nweb.it wrote:

Hello list,

I'm trying to code an SMTP server that stores received messages in a 
queue (es. RabbitMQ or Redis).
I'm figuring out how to do it with Twisted, and so far I managed to 
print to console the messages the way I want.
I'm trying to understand now how to return a tempfail code (4xx) from 
within eomReceived(), so to simulate (and, in the future, handle) 
temporary unavailabilities of the queuing system, and thus to delegate 
to the client the handling/retrying of the delivery (there will be 
postfix in front of my smtp server, so it will keep the message in its 
spool).
I ended up digging in the code until I found the _messageHandled 
callback of the SMTP class, that's added to the deferred returned by 
eomReceived. I admit I'm not very accustomed to deferreds yet, but I 
can only see 250 and 550 response code inside it. I suspect that I 
should return the 4xx code in one of the deferred's callbacks/errbacks 
*before* _messageHandled, but I really can't imagine how. Would you 
please give me some hints about how to accomplish the task? Am I 
looking to the right direction at all?


See https://twistedmatrix.com/trac/ticket/4904

Jean-Paul

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


Re: [Twisted-Python] txThings - simple library for CoAP protocol

2013-11-23 Thread Phil Mayers

On 23/11/13 12:03, Maciej Wasilak wrote:


3. There is a problem with txThings IPv6 server, because in most
operating systems source address of datagram is determined in round
robin fashion. It may cause the source address of the response to be
different than destination address of the request.


This is in general a bit of a pain with UDP apps.

In Twisted, the easiest solution is to specifically bind the UDP sockets 
to the IP address(es) on the host, and always reply on the same 
protocol/transport you received on.


You may find the "netifaces" package helpful for getting a list of IPs 
in a cross-platform manner.


In theory you can avoid doing this if you have sendmsg/recvmsg support, 
but Twisted doesn't have this (yet).


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


[Twisted-Python] Weekly Bug Summary

2013-11-23 Thread trac



Bug summary
__
Summary for 2013-11-17 through 2013-11-24
  Opened Closed  Total Change
Enhancements:  7  3   1142 +4
Defects:   4  2705 +2
Tasks: 0  0 92 +0
Regressions:   0  0  1 +0
Total:11  5   1940 +6

|== Type Changes   |== Priority Changes   |== Component Changes   
|Defect:   +2  |Normal:  +3   |Conch:+1   
|Enhancement:  +4  |Low: +2   |Core: +1   
   |Lowest:  +1   |Names:+2   
  |Trial:+2   
  |Web:  +0   
  |Website:  +0   



Total Tickets
Open Tickets



New / Reopened Bugs
__
= Normal =
[#6841] 13.1.0 documentation is missing "Go to the latest version" links (opened by Julian) (CLOSED, fixed)
defect  websitehttp://twistedmatrix.com/trac/ticket/6841

[#6843] fix link local IPv6 interface detection twisted/internet/test/ for non-OSX BSD (opened by oberstet) (CLOSED, fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/6843

[#6846] Trial test_getTimezoneOffset should be robust to platform specific behavior (opened by oberstet)
enhancement core   http://twistedmatrix.com/trac/ticket/6846

[#6847] twisted.names.dns.Message should have a meaningful repr (opened by rwall)
enhancement names  http://twistedmatrix.com/trac/ticket/6847

[#6848] twisted.names.dns.Messages should be compared based on their field values and section contents (opened by rwall)
enhancement names  http://twistedmatrix.com/trac/ticket/6848

[#6849] twisted.web.http should not import reactor at module level (opened by oberstet)
enhancement webhttp://twistedmatrix.com/trac/ticket/6849

[#6850] twisted.conch.ssh.userauth.SSHUserAuthClient usage of preferredOrder unclear (opened by veloutin)
enhancement conch  http://twistedmatrix.com/trac/ticket/6850

[#6851] Options HOWTO shouldn’t use underbars in example parameter names (opened by wsanchez)
enhancement core   http://twistedmatrix.com/trac/ticket/6851

= Low =
[#6844] Example Code Raises Exception (opened by Zancas)
defect  trial  http://twistedmatrix.com/trac/ticket/6844

[#6845] Confusing (and possibly unnecessary) change of timeOut from class-, to instance- variable makes example code more difficult to follow. (opened by Zancas)
defect  trial  http://twistedmatrix.com/trac/ticket/6845

= Lowest =
[#6842] Dead link in documentation of t.i._dumbwin32proc (opened by tyteen4a03)
defect  core   http://twistedmatrix.com/trac/ticket/6842



Closed Bugs
__
= Normal =
[#6632] remove references to deleted IFinishableConsumer from documentation (opened by daf, closed by itamarst, fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/6632

[#6841] 13.1.0 documentation is missing "Go to the latest version" links (opened by Julian, closed by hawkowl, fixed)
defect  websitehttp://twistedmatrix.com/trac/ticket/6841

[#6843] fix link local IPv6 interface detection twisted/internet/test/ for non-OSX BSD (opened by oberstet, closed by exarkun, fixed)
enhancement core   http://twistedmatrix.com/trac/ticket/6843

[#5004] replace call to functions from the string module in web (opened by nueces, closed by rwall, fixed)
enhancement webhttp://twistedmatrix.com/trac/ticket/5004

[#5728] sendmsg.c does not compile on Solaris (opened by toddmowen, closed by itamarst, fixed)
defect  core   http://twistedmatrix.com/trac/ticket/5728



Ticket Lifetime Stats
__
Oldest open ticket - [#50] conch command-line client doesn't work in win32 (since 2003-07-12 14:41:06).
Newest open ticket - [#6851] Options HOWTO shouldn’t use underbars in example parameter names (since 2013-11-22 12:48:09).

Mean open ticket age: 1272 days, 12:54:36.945034.
Median: 1027 days, 15:47:08.233179.
Standard deviation: 984 days, 10:26:57.950646.
Interquartile range: 1576 days, 10:56:49.

Mean time between ticket creation and ticket resolution: 645 days, 9:17:39.034489.
Median: 103 days, 20:53:42.
Standard deviation is 904 days, 22:45:07.459439.
The interquartile range is 1034 days, 2:57:50.

Mean time spent in review: 95 days, 4:21:58.464239.
Median: 5 days, 0:15:42.
Standard deviation: 423 days, 19:19:01.645554.
Interquartile range: 21 days, 6:06:03.

Mean number of times a ticket is reviewed: 1.94626426205.
Median: 1
Standard deviation: 1.53958377885.
Interquartile range: 1.