rename direction to command for assignment

This commit is contained in:
Stephen Birarda 2013-09-11 14:43:37 -07:00
parent 803d2975dc
commit dfede2b947
5 changed files with 18 additions and 18 deletions

View file

@ -53,7 +53,7 @@ void childClient() {
sockaddr_in senderSocket = {};
// create a request assignment, accept all assignments, pass the desired pool (if it exists)
Assignment requestAssignment(Assignment::RequestDirection, Assignment::AllTypes);
Assignment requestAssignment(Assignment::RequestCommand, Assignment::AllTypes);
while (true) {
if (usecTimestampNow() - usecTimestamp(&lastRequest) >= ASSIGNMENT_REQUEST_INTERVAL_USECS) {

View file

@ -19,7 +19,7 @@
#include <arpa/inet.h>
#include <fcntl.h>
#include <queue>
#include <queue.h>
#include <map>
#include <math.h>
#include <string.h>
@ -106,11 +106,11 @@ int main(int argc, const char* argv[]) {
// as a domain-server we will always want an audio mixer and avatar mixer
// setup the create assignments for those
Assignment audioMixerAssignment(Assignment::CreateDirection,
Assignment audioMixerAssignment(Assignment::CreateCommand,
Assignment::AudioMixerType,
Assignment::LocalLocation);
Assignment avatarMixerAssignment(Assignment::CreateDirection,
Assignment avatarMixerAssignment(Assignment::CreateCommand,
Assignment::AvatarMixerType,
Assignment::LocalLocation);

View file

@ -13,8 +13,8 @@
const char IPv4_ADDRESS_DESIGNATOR = 4;
const char IPv6_ADDRESS_DESIGNATOR = 6;
Assignment::Assignment(Assignment::Direction direction, Assignment::Type type, Assignment::Location location) :
_direction(direction),
Assignment::Assignment(Assignment::Command command, Assignment::Type type, Assignment::Location location) :
_command(command),
_type(type),
_location(location),
_attachedPublicSocket(NULL),
@ -35,11 +35,11 @@ Assignment::Assignment(const unsigned char* dataBuffer, int numBytes) :
int numBytesRead = 0;
if (dataBuffer[0] == PACKET_TYPE_REQUEST_ASSIGNMENT) {
_direction = Assignment::RequestDirection;
_command = Assignment::RequestCommand;
} else if (dataBuffer[0] == PACKET_TYPE_CREATE_ASSIGNMENT) {
_direction = Assignment::CreateDirection;
_command = Assignment::CreateCommand;
} else if (dataBuffer[0] == PACKET_TYPE_DEPLOY_ASSIGNMENT) {
_direction = Assignment::DeployDirection;
_command = Assignment::DeployCommand;
}
numBytesRead += numBytesForPacketHeader(dataBuffer);
@ -60,7 +60,7 @@ Assignment::Assignment(const unsigned char* dataBuffer, int numBytes) :
qDebug("Received a socket that cannot be unpacked!\n");
}
if (_direction == Assignment::CreateDirection) {
if (_command == Assignment::CreateCommand) {
delete _attachedLocalSocket;
_attachedLocalSocket = newSocket;
} else {

View file

@ -23,10 +23,10 @@ public:
AllTypes
};
enum Direction {
CreateDirection,
DeployDirection,
RequestDirection
enum Command {
CreateCommand,
DeployCommand,
RequestCommand
};
enum Location {
@ -34,7 +34,7 @@ public:
LocalLocation
};
Assignment(Assignment::Direction direction,
Assignment(Assignment::Command command,
Assignment::Type type,
Assignment::Location location = Assignment::GlobalLocation);
@ -45,7 +45,7 @@ public:
~Assignment();
Assignment::Direction getDirection() const { return _direction; }
Assignment::Command getCommand() const { return _command; }
Assignment::Type getType() const { return _type; }
Assignment::Location getLocation() const { return _location; }
const timeval& getTime() const { return _time; }
@ -65,7 +65,7 @@ public:
void setCreateTimeToNow() { gettimeofday(&_time, NULL); }
private:
Assignment::Direction _direction; /// the direction of the assignment (Create, Deploy, Request)
Assignment::Command _command; /// the command for this assignment (Create, Deploy, Request)
Assignment::Type _type; /// the type of the assignment, defines what the assignee will do
Assignment::Location _location; /// the location of the assignment, allows a domain to preferentially use local ACs
sockaddr* _attachedPublicSocket; /// pointer to a public socket that relates to assignment, depends on direction

View file

@ -382,7 +382,7 @@ const sockaddr_in GLOBAL_ASSIGNMENT_SOCKET = socketForHostnameAndHostOrderPort(G
void NodeList::sendAssignment(Assignment& assignment) {
unsigned char assignmentPacket[MAX_PACKET_SIZE];
PACKET_TYPE assignmentPacketType = assignment.getDirection() == Assignment::CreateDirection
PACKET_TYPE assignmentPacketType = assignment.getCommand() == Assignment::CreateCommand
? PACKET_TYPE_CREATE_ASSIGNMENT
: PACKET_TYPE_REQUEST_ASSIGNMENT;