mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-19 22:40:36 -04:00
Implemented sockaddr_storage functions.
Fixed interfaces for UPnP. Some further tweaks to get TCP connections working again: - hiddenNode issue in p3peers.cc - fixed socklen_t for bind() and connect() calls. - initialise addr to IPv4 for netmgr. - change netAssist (Upnp) interfaces. Still todo: tou address functions, test UDP functionality. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6755 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6290d8fed9
commit
34ea22d5f6
15 changed files with 1076 additions and 40 deletions
|
@ -219,22 +219,31 @@ int p3BitDht::addBadPeer(const struct sockaddr_storage &addr, uint32_t /*reason*
|
|||
int p3BitDht::addKnownPeer(const std::string &pid, const struct sockaddr_storage &addr, uint32_t flags)
|
||||
{
|
||||
struct sockaddr_in addrv4;
|
||||
|
||||
if (addr.ss_family != AF_INET)
|
||||
{
|
||||
std::cerr << "p3BitDht::addKnownPeer() cannot handle IPV6 Yet, aborting";
|
||||
std::cerr << "p3BitDht::addKnownPeer() Warning! Non IPv4 Address - Cannot handle IPV6 Yet.";
|
||||
std::cerr << std::endl;
|
||||
abort();
|
||||
sockaddr_clear(&addrv4);
|
||||
|
||||
if (flags & NETASSIST_KNOWN_PEER_ONLINE)
|
||||
{
|
||||
std::cerr << "p3BitDht::addKnownPeer() Non IPv4 Address & ONLINE. Abort()ing.";
|
||||
std::cerr << std::endl;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
struct sockaddr_in *ap = (struct sockaddr_in *) &addr;
|
||||
|
||||
// convert.
|
||||
addrv4.sin_family = ap->sin_family;
|
||||
addrv4.sin_addr = ap->sin_addr;
|
||||
addrv4.sin_port = ap->sin_port;
|
||||
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
// convert.
|
||||
struct sockaddr_in *ap = (struct sockaddr_in *) &addr;
|
||||
|
||||
addrv4.sin_family = ap->sin_family;
|
||||
addrv4.sin_addr = ap->sin_addr;
|
||||
addrv4.sin_port = ap->sin_port;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int p3type = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue