mirror of https://github.com/aria2/aria2
2010-08-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed uitos(). Use util::uitos() instead. * src/SocketCore.ccpull/1/head
parent
d7902f0ed7
commit
9b9f3a6c63
|
@ -1,3 +1,8 @@
|
||||||
|
2010-08-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Removed uitos(). Use util::uitos() instead.
|
||||||
|
* src/SocketCore.cc
|
||||||
|
|
||||||
2010-08-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-08-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Don't try to send empty string.
|
Don't try to send empty string.
|
||||||
|
|
|
@ -168,22 +168,6 @@ SocketCore::~SocketCore() {
|
||||||
#endif // HAVE_LIBGNUTLS
|
#endif // HAVE_LIBGNUTLS
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
std::string uitos(T value)
|
|
||||||
{
|
|
||||||
std::string str;
|
|
||||||
if(value == 0) {
|
|
||||||
str = "0";
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
while(value) {
|
|
||||||
char digit = value%10+'0';
|
|
||||||
str.insert(str.begin(), digit);
|
|
||||||
value /= 10;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SocketCore::create(int family, int protocol)
|
void SocketCore::create(int family, int protocol)
|
||||||
{
|
{
|
||||||
closeConnection();
|
closeConnection();
|
||||||
|
@ -237,8 +221,8 @@ static sock_t bindTo
|
||||||
int getaddrinfoFlags, std::string& error)
|
int getaddrinfoFlags, std::string& error)
|
||||||
{
|
{
|
||||||
struct addrinfo* res;
|
struct addrinfo* res;
|
||||||
int s = callGetaddrinfo(&res, host, uitos(port).c_str(), family, sockType,
|
int s = callGetaddrinfo(&res, host, util::uitos(port).c_str(),
|
||||||
getaddrinfoFlags, 0);
|
family, sockType, getaddrinfoFlags, 0);
|
||||||
if(s) {
|
if(s) {
|
||||||
error = gai_strerror(s);
|
error = gai_strerror(s);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -392,8 +376,8 @@ void SocketCore::establishConnection(const std::string& host, uint16_t port)
|
||||||
std::string error;
|
std::string error;
|
||||||
struct addrinfo* res;
|
struct addrinfo* res;
|
||||||
int s;
|
int s;
|
||||||
s = callGetaddrinfo(&res, host.c_str(), uitos(port).c_str(), protocolFamily_,
|
s = callGetaddrinfo(&res, host.c_str(), util::uitos(port).c_str(),
|
||||||
sockType_, 0, 0);
|
protocolFamily_, sockType_, 0, 0);
|
||||||
if(s) {
|
if(s) {
|
||||||
throw DL_ABORT_EX(StringFormat(EX_RESOLVE_HOSTNAME,
|
throw DL_ABORT_EX(StringFormat(EX_RESOLVE_HOSTNAME,
|
||||||
host.c_str(), gai_strerror(s)).str());
|
host.c_str(), gai_strerror(s)).str());
|
||||||
|
@ -1139,8 +1123,8 @@ ssize_t SocketCore::writeData(const char* data, size_t len,
|
||||||
|
|
||||||
struct addrinfo* res;
|
struct addrinfo* res;
|
||||||
int s;
|
int s;
|
||||||
s = callGetaddrinfo(&res, host.c_str(), uitos(port).c_str(), protocolFamily_,
|
s = callGetaddrinfo(&res, host.c_str(), util::uitos(port).c_str(),
|
||||||
sockType_, 0, 0);
|
protocolFamily_, sockType_, 0, 0);
|
||||||
if(s) {
|
if(s) {
|
||||||
throw DL_ABORT_EX(StringFormat(EX_SOCKET_SEND, gai_strerror(s)).str());
|
throw DL_ABORT_EX(StringFormat(EX_SOCKET_SEND, gai_strerror(s)).str());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue