mirror of
https://github.com/overte-org/overte.git
synced 2025-08-16 12:11:31 +02:00
add sendAssignmentRequest method to AgentList
This commit is contained in:
parent
b9c1525321
commit
eb8faa3667
4 changed files with 23 additions and 0 deletions
|
@ -257,6 +257,16 @@ void AgentList::sendDomainServerCheckIn() {
|
|||
_agentSocket.send(DOMAIN_IP, DOMAINSERVER_PORT, checkInPacket, checkInPacketSize);
|
||||
}
|
||||
|
||||
void AgentList::sendAssignmentRequest() {
|
||||
const char ASSIGNMENT_SERVER_HOSTNAME[] = "assignment.highfidelity.io";
|
||||
const unsigned short ASSIGNMENT_SERVER_PORT = 7007;
|
||||
|
||||
static sockaddr_in assignmentServerSocket = socketForHostname(ASSIGNMENT_SERVER_HOSTNAME);
|
||||
assignmentServerSocket.sin_port = htons(ASSIGNMENT_SERVER_PORT);
|
||||
|
||||
_agentSocket.send((sockaddr *) &assignmentServerSocket, &PACKET_HEADER_REQUEST_ASSIGNMENT, 1);
|
||||
}
|
||||
|
||||
int AgentList::processDomainServerList(unsigned char *packetData, size_t dataBytes) {
|
||||
int readAgents = 0;
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
|
||||
void setAgentTypesOfInterest(const char* agentTypesOfInterest, int numAgentTypesOfInterest);
|
||||
void sendDomainServerCheckIn();
|
||||
void sendAssignmentRequest();
|
||||
int processDomainServerList(unsigned char *packetData, size_t dataBytes);
|
||||
|
||||
Agent* agentWithAddress(sockaddr *senderAddress);
|
||||
|
|
|
@ -117,6 +117,17 @@ unsigned short loadBufferWithSocketInfo(char* addressBuffer, sockaddr* socket) {
|
|||
}
|
||||
}
|
||||
|
||||
sockaddr_in socketForHostname(const char* hostname) {
|
||||
struct hostent* pHostInfo;
|
||||
sockaddr_in newSocket;
|
||||
|
||||
if ((pHostInfo = gethostbyname(hostname))) {
|
||||
memcpy(&newSocket.sin_addr, pHostInfo->h_addr_list[0], pHostInfo->h_length);
|
||||
}
|
||||
|
||||
return newSocket;
|
||||
}
|
||||
|
||||
UDPSocket::UDPSocket(int listeningPort) : listeningPort(listeningPort), blocking(true) {
|
||||
init();
|
||||
// create the socket
|
||||
|
|
|
@ -42,5 +42,6 @@ int packSocket(unsigned char* packStore, sockaddr* socketToPack);
|
|||
int unpackSocket(unsigned char* packedData, sockaddr* unpackDestSocket);
|
||||
int getLocalAddress();
|
||||
unsigned short loadBufferWithSocketInfo(char* addressBuffer, sockaddr* socket);
|
||||
sockaddr_in socketForHostname(const char* hostname);
|
||||
|
||||
#endif /* defined(__interface__UDPSocket__) */
|
||||
|
|
Loading…
Reference in a new issue