store senderSocket with assignment to be passed to requestor

This commit is contained in:
Stephen Birarda 2013-08-22 12:08:49 -07:00
parent 2804d286d5
commit ef7e7ae4c5
4 changed files with 14 additions and 1 deletions

View file

@ -45,7 +45,10 @@ int main(int argc, const char* argv[]) {
// send the assignment
}
} else if (senderData[0] == PACKET_TYPE_SEND_ASSIGNMENT && packetVersionMatch(senderData)) {
Assignment newAssignment((Assignment::Type) *(senderData + numBytesForPacketHeader(senderData)));
// assignment server is on a public server
// assume that the address we now have for the sender is the public address/port
// and store that with the assignment so it can be given to the requestor later
Assignment newAssignment((Assignment::Type) *(senderData + numBytesForPacketHeader(senderData)), senderSocket);
qDebug() << "Received assignment of type " << newAssignment.getType() << "\n";

View file

@ -90,6 +90,7 @@ int main(int argc, const char * argv[])
if (!nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER)) {
// we don't have an audio mixer, and we know we need one
// so tell that to the assignment server
Assignment mixerAssignment(Assignment::AudioMixer);
nodeList->sendAssignment(mixerAssignment);
}

View file

@ -10,4 +10,10 @@
Assignment::Assignment(Assignment::Type type) : _type(type) {
}
Assignment::Assignment(Assignment::Type type, sockaddr_in& senderSocket) :
_type(type),
_senderSocket(senderSocket) {
}

View file

@ -19,10 +19,13 @@ public:
};
Assignment(Assignment::Type type);
Assignment(Assignment::Type type, sockaddr_in& senderSocket);
Assignment::Type getType() const { return _type; }
private:
Assignment::Type _type;
sockaddr_in _senderSocket;
};