integrated changes for 1.2.3

This commit is contained in:
Guenter Obiltschnig
2006-09-14 16:46:36 +00:00
parent 0a517d5e30
commit a01116ca11
25 changed files with 550 additions and 136 deletions

View File

@@ -1,7 +1,7 @@
//
// IPAddress.cpp
//
// $Id: //poco/1.2/Net/src/IPAddress.cpp#1 $
// $Id: //poco/1.2/Net/src/IPAddress.cpp#2 $
//
// Library: Net
// Package: NetCore
@@ -221,6 +221,7 @@ public:
static IPv4AddressImpl* parse(const std::string& addr)
{
if (addr.empty()) return 0;
#if defined(_WIN32)
struct in_addr ia;
ia.s_addr = inet_addr(addr.c_str());
@@ -412,6 +413,7 @@ public:
static IPv6AddressImpl* parse(const std::string& addr)
{
if (addr.empty()) return 0;
#if defined(_WIN32)
struct addrinfo* pAI;
struct addrinfo hints;

View File

@@ -1,7 +1,7 @@
//
// MailMessage.cpp
//
// $Id: //poco/1.2/Net/src/MailMessage.cpp#2 $
// $Id: //poco/1.2/Net/src/MailMessage.cpp#3 $
//
// Library: Net
// Package: Mail
@@ -444,6 +444,8 @@ void MailMessage::setRecipientHeaders(MessageHeader& headers) const
case MailRecipient::CC_RECIPIENT:
appendRecipient(*it, cc);
break;
case MailRecipient::BCC_RECIPIENT:
break;
}
}
if (!to.empty()) headers.set(HEADER_TO, to);

View File

@@ -1,7 +1,7 @@
//
// Socket.cpp
//
// $Id: //poco/1.2/Net/src/Socket.cpp#1 $
// $Id: //poco/1.2/Net/src/Socket.cpp#2 $
//
// Library: Net
// Package: Sockets
@@ -36,6 +36,7 @@
#include "Poco/Net/Socket.h"
#include "Poco/Net/StreamSocketImpl.h"
#include "Poco/Timestamp.h"
#include <algorithm>
#include <string.h>
@@ -111,10 +112,26 @@ int Socket::select(SocketList& readList, SocketList& writeList, SocketList& exce
nfd = int(it->sockfd());
FD_SET(it->sockfd(), &fdExcept);
}
struct timeval tv;
tv.tv_sec = (long) timeout.totalSeconds();
tv.tv_usec = (long) timeout.useconds();
int rc = ::select(nfd + 1, &fdRead, &fdWrite, &fdExcept, &tv);
Poco::Timespan remainingTime(timeout);
int rc;
do
{
struct timeval tv;
tv.tv_sec = (long) remainingTime.totalSeconds();
tv.tv_usec = (long) remainingTime.useconds();
Poco::Timestamp start;
rc = ::select(nfd + 1, &fdRead, &fdWrite, &fdExcept, &tv);
if (rc < 0 && SocketImpl::lastError() == POCO_EINTR)
{
Poco::Timestamp end;
Poco::Timespan waited = end - start;
if (waited > remainingTime)
remainingTime -= waited;
else
remainingTime = 0;
}
}
while (rc < 0 && SocketImpl::lastError() == POCO_EINTR);
if (rc < 0) SocketImpl::error();
SocketList readyReadList;

View File

@@ -1,7 +1,7 @@
//
// SocketImpl.cpp
//
// $Id: //poco/1.2/Net/src/SocketImpl.cpp#1 $
// $Id: //poco/1.2/Net/src/SocketImpl.cpp#2 $
//
// Library: Net
// Package: Sockets
@@ -38,6 +38,7 @@
#include "Poco/Net/NetException.h"
#include "Poco/Net/StreamSocketImpl.h"
#include "Poco/NumberFormatter.h"
#include "Poco/Timestamp.h"
#include <string.h>
@@ -345,10 +346,26 @@ bool SocketImpl::poll(const Poco::Timespan& timeout, int mode)
{
FD_SET(_sockfd, &fdExcept);
}
struct timeval tv;
tv.tv_sec = (long) timeout.totalSeconds();
tv.tv_usec = (long) timeout.useconds();
int rc = ::select(int(_sockfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv);
Poco::Timespan remainingTime(timeout);
int rc;
do
{
struct timeval tv;
tv.tv_sec = (long) remainingTime.totalSeconds();
tv.tv_usec = (long) remainingTime.useconds();
Poco::Timestamp start;
rc = ::select(int(_sockfd) + 1, &fdRead, &fdWrite, &fdExcept, &tv);
if (rc < 0 && lastError() == POCO_EINTR)
{
Poco::Timestamp end;
Poco::Timespan waited = end - start;
if (waited > remainingTime)
remainingTime -= waited;
else
remainingTime = 0;
}
}
while (rc < 0 && lastError() == POCO_EINTR);
if (rc < 0) error();
return rc > 0;
}