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
This commit is contained in:
parent
3177724f8c
commit
5d12f64c57
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "pop3.h"
|
#include "pop3.h"
|
||||||
|
|
||||||
#define POP3_RETRIEVAL_TIMEOUT 30000000
|
#define POP3_RETRIEVAL_TIMEOUT 60000000
|
||||||
#define CRLF "\r\n"
|
#define CRLF "\r\n"
|
||||||
|
|
||||||
|
|
||||||
@ -95,20 +95,23 @@ POP3Protocol::Open(const char *server, int port, int)
|
|||||||
|
|
||||||
fLog = "";
|
fLog = "";
|
||||||
|
|
||||||
//-----Prime the error message
|
// Prime the error message
|
||||||
BString error_msg;
|
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)
|
if (port != 110)
|
||||||
error_msg << ":" << port;
|
error_msg << ":" << port;
|
||||||
|
|
||||||
uint32 hostIP = inet_addr(server); // first see if we can parse it as a numeric address
|
uint32 hostIP = inet_addr(server);
|
||||||
if ((hostIP == 0)||(hostIP == (uint32)-1)) {
|
// first see if we can parse it as a numeric address
|
||||||
|
if (hostIP == 0 || hostIP == ~0UL) {
|
||||||
struct hostent * he = gethostbyname(server);
|
struct hostent * he = gethostbyname(server);
|
||||||
hostIP = he ? *((uint32*)he->h_addr) : 0;
|
hostIP = he ? *((uint32*)he->h_addr) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hostIP == 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());
|
runner->ShowError(error_msg.String());
|
||||||
|
|
||||||
return B_NAME_NOT_FOUND;
|
return B_NAME_NOT_FOUND;
|
||||||
@ -179,12 +182,16 @@ POP3Protocol::Open(const char *server, int port, int)
|
|||||||
|
|
||||||
BString line;
|
BString line;
|
||||||
status_t err;
|
status_t err;
|
||||||
|
#ifndef HAIKU_TARGET_PLATFORM_BEOS
|
||||||
|
err = ReceiveLine(line);
|
||||||
|
#else
|
||||||
int32 tries = 200000;
|
int32 tries = 200000;
|
||||||
// no endless loop here
|
// no endless loop here
|
||||||
while ((err = ReceiveLine(line)) == 0) {
|
while ((err = ReceiveLine(line)) == 0) {
|
||||||
if (tries-- < 0)
|
if (tries-- < 0)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
#ifndef HAIKU_TARGET_PLATFORM_BEOS
|
#ifndef HAIKU_TARGET_PLATFORM_BEOS
|
||||||
|
Loading…
Reference in New Issue
Block a user