mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 19:04:32 +02:00
commit
5a8a95f367
8 changed files with 24 additions and 9 deletions
|
@ -35,10 +35,10 @@ IceServer::IceServer(int argc, char* argv[]) :
|
|||
_serverSocket.bind(QHostAddress::AnyIPv4, ICE_SERVER_DEFAULT_PORT);
|
||||
|
||||
// set processPacket as the verified packet callback for the udt::Socket
|
||||
using std::placeholders::_1;
|
||||
_serverSocket.setPacketHandler(std::bind(&IceServer::processPacket, this, _1));
|
||||
_serverSocket.setPacketHandler([this](std::unique_ptr<udt::Packet> packet) { processPacket(std::move(packet)); });
|
||||
|
||||
// set packetVersionMatch as the verify packet operator for the udt::Socket
|
||||
using std::placeholders::_1;
|
||||
_serverSocket.setPacketFilterOperator(std::bind(&IceServer::packetVersionMatch, this, _1));
|
||||
|
||||
// setup our timer to clear inactive peers
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#ifndef hifi_HifiSockAddr_h
|
||||
#define hifi_HifiSockAddr_h
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#ifdef WIN32
|
||||
|
|
|
@ -94,11 +94,19 @@ LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short
|
|||
updateLocalSockAddr();
|
||||
|
||||
// set &PacketReceiver::handleVerifiedPacket as the verified packet callback for the udt::Socket
|
||||
using std::placeholders::_1;
|
||||
_nodeSocket.setPacketHandler(std::bind(&PacketReceiver::handleVerifiedPacket, _packetReceiver, _1));
|
||||
_nodeSocket.setPacketListHandler(std::bind(&PacketReceiver::handleVerifiedPacketList, _packetReceiver, _1));
|
||||
_nodeSocket.setPacketHandler(
|
||||
[this](std::unique_ptr<udt::Packet> packet) {
|
||||
_packetReceiver->handleVerifiedPacket(std::move(packet));
|
||||
}
|
||||
);
|
||||
_nodeSocket.setPacketListHandler(
|
||||
[this](std::unique_ptr<udt::PacketList> packetList) {
|
||||
_packetReceiver->handleVerifiedPacketList(std::move(packetList));
|
||||
}
|
||||
);
|
||||
|
||||
// set our isPacketVerified method as the verify operator for the udt::Socket
|
||||
using std::placeholders::_1;
|
||||
_nodeSocket.setPacketFilterOperator(std::bind(&LimitedNodeList::isPacketVerified, this, _1));
|
||||
|
||||
_packetStatTimer.start();
|
||||
|
@ -763,8 +771,7 @@ void LimitedNodeList::possiblyTimeoutSTUNAddressLookup() {
|
|||
|
||||
void LimitedNodeList::addSTUNHandlerToUnfiltered() {
|
||||
// make ourselves the handler of STUN packets when they come in
|
||||
using std::placeholders::_1;
|
||||
_nodeSocket.addUnfilteredHandler(_stunSockAddr, std::bind(&LimitedNodeList::processSTUNResponse, this, _1));
|
||||
_nodeSocket.addUnfilteredHandler(_stunSockAddr, [this](std::unique_ptr<udt::BasePacket> packet) { processSTUNResponse(std::move(packet)); });
|
||||
}
|
||||
|
||||
void LimitedNodeList::stopInitialSTUNUpdate(bool success) {
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <QObject>
|
||||
#include <QUrl>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class ResourceRequest : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
@ -31,6 +31,8 @@ public:
|
|||
static std::unique_ptr<BasePacket> create(qint64 size = -1);
|
||||
static std::unique_ptr<BasePacket> fromReceivedPacket(std::unique_ptr<char[]> data, qint64 size,
|
||||
const HifiSockAddr& senderSockAddr);
|
||||
|
||||
|
||||
|
||||
// Current level's header size
|
||||
static int localHeaderSize();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#define hifi_CongestionControl_h
|
||||
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <unordered_map>
|
||||
|
||||
|
|
|
@ -176,8 +176,8 @@ UDTTest::UDTTest(int& argc, char** argv) :
|
|||
} else {
|
||||
// this is a receiver - in case there are ordered packets (messages) being sent to us make sure that we handle them
|
||||
// so that they can be verified
|
||||
using std::placeholders::_1;
|
||||
_socket.setPacketListHandler(std::bind(&UDTTest::handlePacketList, this, _1));
|
||||
_socket.setPacketListHandler(
|
||||
[this](std::unique_ptr<udt::PacketList> packetList) { handlePacketList(std::move(packetList)); });
|
||||
}
|
||||
|
||||
// the sender reports stats every 100 milliseconds, unless passed a custom value
|
||||
|
|
Loading…
Reference in a new issue