mirror of
https://github.com/overte-org/overte.git
synced 2025-04-11 13:42:38 +02:00
use new networking in sendPacketToIceServer
This commit is contained in:
parent
402f7dc075
commit
e7e489af61
3 changed files with 15 additions and 15 deletions
|
@ -62,21 +62,22 @@ void IceServer::processDatagrams() {
|
|||
// so that we can send packets to the heartbeating peer when we need, we need to activate a socket now
|
||||
peer->activateMatchingOrNewSymmetricSocket(sendingSockAddr);
|
||||
} else if (packetType == PacketTypeIceServerQuery) {
|
||||
QDataStream heartbeatStream(incomingPacket);
|
||||
|
||||
// this is a node hoping to connect to a heartbeating peer - do we have the heartbeating peer?
|
||||
QUuid senderUUID = uuidFromPacketHeader(incomingPacket);
|
||||
QUuid senderUUID;
|
||||
heartbeatStream >> senderUUID;
|
||||
|
||||
// pull the public and private sock addrs for this peer
|
||||
HifiSockAddr publicSocket, localSocket;
|
||||
|
||||
QDataStream hearbeatStream(incomingPacket);
|
||||
hearbeatStream.skipRawData(numBytesForPacketHeader(incomingPacket));
|
||||
heartbeatStream.skipRawData(numBytesForPacketHeader(incomingPacket));
|
||||
|
||||
hearbeatStream >> publicSocket >> localSocket;
|
||||
heartbeatStream >> publicSocket >> localSocket;
|
||||
|
||||
// check if this node also included a UUID that they would like to connect to
|
||||
QUuid connectRequestID;
|
||||
hearbeatStream >> connectRequestID;
|
||||
heartbeatStream >> connectRequestID;
|
||||
|
||||
SharedNetworkPeer matchingPeer = _activePeers.value(connectRequestID);
|
||||
|
||||
|
|
|
@ -848,23 +848,22 @@ void LimitedNodeList::updateLocalSockAddr() {
|
|||
}
|
||||
|
||||
void LimitedNodeList::sendHeartbeatToIceServer(const HifiSockAddr& iceServerSockAddr) {
|
||||
sendPacketToIceServer(PacketTypeIceServerHeartbeat, iceServerSockAddr, _sessionUUID);
|
||||
sendPacketToIceServer(PacketType::ICEServerHeartbeat, iceServerSockAddr, _sessionUUID);
|
||||
}
|
||||
|
||||
void LimitedNodeList::sendPeerQueryToIceServer(const HifiSockAddr& iceServerSockAddr, const QUuid& clientID,
|
||||
const QUuid& peerID) {
|
||||
sendPacketToIceServer(PacketTypeIceServerQuery, iceServerSockAddr, clientID, peerID);
|
||||
sendPacketToIceServer(PacketType::ICEServerQuery, iceServerSockAddr, clientID, peerID);
|
||||
}
|
||||
|
||||
void LimitedNodeList::sendPacketToIceServer(PacketType::Value packetType, const HifiSockAddr& iceServerSockAddr,
|
||||
const QUuid& headerID, const QUuid& peerID) {
|
||||
const QUuid& clientID, const QUuid& peerID) {
|
||||
auto icePacket = Packet::create(packetType);
|
||||
|
||||
QByteArray iceRequestByteArray = byteArrayWithUUIDPopulatedHeader(packetType, headerID);
|
||||
QDataStream iceDataStream(&iceRequestByteArray, QIODevice::Append);
|
||||
QDataStream iceDataStream(icePacket.get());
|
||||
iceDataStream << clientID << _publicSockAddr << _localSockAddr;
|
||||
|
||||
iceDataStream << _publicSockAddr << _localSockAddr;
|
||||
|
||||
if (packetType == PacketTypeIceServerQuery) {
|
||||
if (packetType == PacketType::ICEServerQuery) {
|
||||
assert(!peerID.isNull());
|
||||
|
||||
iceDataStream << peerID;
|
||||
|
@ -873,7 +872,7 @@ void LimitedNodeList::sendPacketToIceServer(PacketType::Value packetType, const
|
|||
<< uuidStringWithoutCurlyBraces(peerID);
|
||||
}
|
||||
|
||||
writeUnverifiedDatagram(iceRequestByteArray, iceServerSockAddr);
|
||||
sendPacket(icePacket, iceServerSockAddr);
|
||||
}
|
||||
|
||||
void LimitedNodeList::putLocalPortIntoSharedMemory(const QString key, QObject* parent, quint16 localPort) {
|
||||
|
|
|
@ -287,7 +287,7 @@ protected:
|
|||
|
||||
void stopInitialSTUNUpdate(bool success);
|
||||
|
||||
void sendPacketToIceServer(PacketType::Value packetType, const HifiSockAddr& iceServerSockAddr, const QUuid& headerID,
|
||||
void sendPacketToIceServer(PacketType::Value packetType, const HifiSockAddr& iceServerSockAddr, const QUuid& clientID,
|
||||
const QUuid& peerRequestID = QUuid());
|
||||
|
||||
QUuid _sessionUUID;
|
||||
|
|
Loading…
Reference in a new issue