tcurdt / edmessage

fork of the edmessage smtp framework for Cocoa

Home Page:http://www.mulle-kybernetik.com/software/EDFrameworks/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SMTP sockets have no timeout values

countach opened this issue · comments

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

  • (EDSMTPStream *)_getStream
    ..... etc
    [[stream socket] setReceiveTimeout:timeout];
  • (id)init
    ... etc
    // set a reasonable timeout. RFC 5321 specifies 10 minutes for some things.
    timeout = 10.0 * 60.0;

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?

+1 to all you said in this issue.

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