Browse Source

Fixed bug in Socket::accept() when port is assigned.

release/0.19
JustinAJ 10 years ago
parent
commit
3612c3f6cb
  1. 16
      Jupiter/Socket.cpp
  2. BIN
      Release/Jupiter.lib

16
Jupiter/Socket.cpp

@ -366,13 +366,17 @@ Jupiter::Socket *Jupiter::Socket::accept()
r->data_->sockType = Jupiter::Socket::data_->sockType; r->data_->sockType = Jupiter::Socket::data_->sockType;
r->data_->sockProto = Jupiter::Socket::data_->sockProto; r->data_->sockProto = Jupiter::Socket::data_->sockProto;
r->data_->host.set(resolved); r->data_->host.set(resolved);
char *end = resolved + r->data_->host.size(); switch (addr.sa_family)
while (end != resolved)
{ {
if (*--end == ':') case AF_INET:
break; r->data_->port = ntohs(reinterpret_cast<sockaddr_in *>(&addr)->sin_port);
r->data_->port *= 10; break;
r->data_->port += static_cast<unsigned char>(Jupiter_getBase(*end, 10)); case AF_INET6:
r->data_->port = ntohs(reinterpret_cast<sockaddr_in6 *>(&addr)->sin6_port);
break;
default:
r->data_->port = 0x00000000;
break;
} }
return r; return r;
} }

BIN
Release/Jupiter.lib

Binary file not shown.
Loading…
Cancel
Save