tcurdt / edmessage

fork of the edmessage smtp framework for Cocoa
http://www.mulle-kybernetik.com/software/EDFrameworks/
38 stars 6 forks source link

SMTP sockets have no timeout values #2

Open countach opened 14 years ago

countach commented 14 years ago

The use of sockets in edmessage have no socket timeout values. RFC 5321 specifies various timeout values for various parts of the protocol ranging from a few minutes to 10 minutes. But right now, the thing can hang forever, or at least a long time. This is a big problem because lots of SMTP hosts can hang on common ports. For example, smtp.gmail.com gives no welcome message on ports 25 and 465 which are common SMTP ports. Of course google actually want you to use port 587, but the point is, connecting with expected ports causes the protocol and therefore the software to hang, and this is very bad.

Now, RFC 5321 specifies 10 minutes timeout in this scenario, but I for one don't even want to wait that long. Maybe that was ok on computers 20 years ago, but these days that is too long. So we need a configurable timeout value. So we need to add a variable to EDMailAgent:

@interface EDMailAgent : NSObject NSTimeInterval timeout;

@property(assign) NSTimeInterval timeout;

and in _getStream

And there we go. Now we can set the timeout for the agent manually, and at least we get a semi-reasonable and RFC compliant default.

On another note, I'm not sure why my performance issue about NSHost is now in the closed section of Issues. Is this project being actively maintained?

tcurdt commented 14 years ago

+1 to all you said in this issue.

Not sure who/why the other one was closed. Re-opened that.