From 5d12f64c57b51f3415dd980b332a2acc01f35544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 31 Jul 2007 16:41:06 +0000 Subject: [PATCH] I have no idea why it would be a good idea to call ReceiveLine() 200000 times if it didn't deliver a line back, but I've changed it such that it only does this for R5. I've enlarged the timeout back to 60 seconds, as I guess that could have been the culprit. Tested here, and it at least still works. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21772 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../inbound_protocols/pop3/pop3.cpp | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp b/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp index 5f14131c1b..408addcae5 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/pop3/pop3.cpp @@ -39,7 +39,7 @@ #include "pop3.h" -#define POP3_RETRIEVAL_TIMEOUT 30000000 +#define POP3_RETRIEVAL_TIMEOUT 60000000 #define CRLF "\r\n" @@ -95,25 +95,28 @@ POP3Protocol::Open(const char *server, int port, int) fLog = ""; - //-----Prime the error message + // Prime the error message BString error_msg; - error_msg << MDR_DIALECT_CHOICE ("Error while connecting to server ","サーバに接続中にエラーが発生しました ") << server; + error_msg << MDR_DIALECT_CHOICE("Error while connecting to server ", + "サーバに接続中にエラーが発生しました ") << server; if (port != 110) error_msg << ":" << port; - - uint32 hostIP = inet_addr(server); // first see if we can parse it as a numeric address - if ((hostIP == 0)||(hostIP == (uint32)-1)) { + + uint32 hostIP = inet_addr(server); + // first see if we can parse it as a numeric address + if (hostIP == 0 || hostIP == ~0UL) { struct hostent * he = gethostbyname(server); hostIP = he ? *((uint32*)he->h_addr) : 0; } if (hostIP == 0) { - error_msg << MDR_DIALECT_CHOICE (": Connection refused or host not found",": :接続が拒否されたかサーバーが見つかりません"); + error_msg << MDR_DIALECT_CHOICE(": Connection refused or host not found", + ": :接続が拒否されたかサーバーが見つかりません"); runner->ShowError(error_msg.String()); return B_NAME_NOT_FOUND; } - + #ifndef HAIKU_TARGET_PLATFORM_BEOS fSocket = socket(AF_INET, SOCK_STREAM, 0); #else @@ -179,12 +182,16 @@ POP3Protocol::Open(const char *server, int port, int) BString line; status_t err; +#ifndef HAIKU_TARGET_PLATFORM_BEOS + err = ReceiveLine(line); +#else int32 tries = 200000; // no endless loop here while ((err = ReceiveLine(line)) == 0) { if (tries-- < 0) return B_ERROR; } +#endif if (err < 0) { #ifndef HAIKU_TARGET_PLATFORM_BEOS