本文整理汇总了C++中DEBUGPRINT函数的典型用法代码示例。如果您正苦于以下问题:C++ DEBUGPRINT函数的具体用法?C++ DEBUGPRINT怎么用?C++ DEBUGPRINT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DEBUGPRINT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DEBUGPRINT
void NosuchGraphics::background(int b) {
DEBUGPRINT(("NosuchGraphics::background!"));
}
示例2: DEBUGPRINT
void TPropertyEditorMultiChoice::SetProperty(TProperty *AProperty,int32 AnIndex,BHandler *AHandler)
{
DEBUGPRINT("TPropertyEditorMultiChoice::SetProperty Inside.");
FView->SetProperty(AProperty,AnIndex,AHandler);
DEBUGPRINT("TPropertyEditorMultiChoice::SetProperty Quitting.");
}
示例3: switch
void PhysicsComponent::onEvent(Event* e)
{
EventType type = e->getType();
switch(type)
{
case EVENT_ATTRIBUTE_UPDATED: //Removes physics objects when the corresponding physics attribute is removed
{
Event_AttributeUpdated* attributeUpdated = static_cast<Event_AttributeUpdated*>(e);
int attributeIndex = attributeUpdated->index;
if(attributeUpdated->attributeEnum == ATTRIBUTE_PHYSICS)
{
if(attributeUpdated->isDeleted)
{
if(attributeIndex < physicsObjects_->size() && physicsObjects_->at(attributeIndex) != nullptr)
{
dynamicsWorld_->removeRigidBody(physicsObjects_->at(attributeIndex));
delete physicsObjects_->at(attributeIndex);
physicsObjects_->at(attributeIndex) = nullptr;
}
else
{
DEBUGPRINT("Mismatch when synchronizing deletion of physics objects with physics attributes");
}
}
else if(attributeUpdated->isCreated)
{
}
else
{
itrPhysics.at(attributeIndex)->reloadDataIntoBulletPhysics = true;
}
}
/*else if(attributeUpdated->attributeEnum == ATTRIBUTE_CAMERA)
{
if(attributeUpdated->isDeleted)
{
dynamicsWorld_->removeRigidBody(frustumPhysicsObjects_->at(attributeIndex));
delete frustumPhysicsObjects_->at(attributeIndex);
frustumPhysicsObjects_->at(attributeIndex) = nullptr;
}
}*/
break;
}
case EVENT_MODIFY_PHYSICS_OBJECT:
{
Event_ModifyPhysicsObject* modifyPhysicsObject = static_cast<Event_ModifyPhysicsObject*>(e);
int physicsAttributeIndex = modifyPhysicsObject->ptr_physics.index();
if(physicsAttributeIndex < physicsObjects_->size() && physicsAttributeIndex > -1)
{
PhysicsObject* physicsObject = physicsObjects_->at(physicsAttributeIndex);
if(physicsObject != NULL)
{
//Cast void pointer sent in Event_ModifyPhysicsObject to its expected data type and modify physics object accordingly
switch(modifyPhysicsObject->modifyWhatDataInPhysicsObjectData)
{
case XKILL_Enums::ModifyPhysicsObjectData::GRAVITY:
{
Float3* gravity = static_cast<Float3*>(modifyPhysicsObject->data);
physicsObject->setGravity(btVector3(gravity->x, gravity->y, gravity->z));
break;
}
case XKILL_Enums::ModifyPhysicsObjectData::VELOCITY:
{
Float3* velocity = static_cast<Float3*>(modifyPhysicsObject->data);
physicsObject->setLinearVelocity(btVector3(velocity->x, velocity->y, velocity->z));
break;
}
case XKILL_Enums::ModifyPhysicsObjectData::VELOCITYPERCENTAGE:
{
Float3* velocityPercentage = static_cast<Float3*>(modifyPhysicsObject->data);
btVector3 currentLinearVelocity = physicsObject->getLinearVelocity();
physicsObject->setLinearVelocity(btVector3(currentLinearVelocity.x()*velocityPercentage->x, currentLinearVelocity.y()*velocityPercentage->y, currentLinearVelocity.z()*velocityPercentage->z));
break;
}
case XKILL_Enums::ModifyPhysicsObjectData::FLAG_STATIC:
{
bool* staticPhysicsObject = static_cast<bool*>(modifyPhysicsObject->data);
if(*staticPhysicsObject == true)
{
physicsObject->setCollisionFlags(physicsObject->getCollisionFlags() | btCollisionObject::CF_STATIC_OBJECT);
}
else if(*staticPhysicsObject == false)
{
physicsObject->setCollisionFlags(physicsObject->getCollisionFlags() & ~ btCollisionObject::CF_STATIC_OBJECT);
}
break;
}
case XKILL_Enums::ModifyPhysicsObjectData::COLLISIONFILTERMASK:
{
/*In order to modify "collisionFilterMask", a physics objects needs to be removed from the Bullet Physics dynamics world and then readded using "addRigidBody", where "collisionFilterMask" is passed as argument.
Write physics object data to physics attribute, modify "collisionFilterMask", and set the "reloadDataIntoBulletPhysics" flag, and this class will handle the removal and addition of the physics object.*/
short* collisionFilterMaskFromEvent = static_cast<short*>(modifyPhysicsObject->data);
AttributePtr<Attribute_Physics> ptr_physics = itrPhysics.at(physicsAttributeIndex);
//.........这里部分代码省略.........
示例4: DebugMsgNKFMSignal
extern "C" void DebugMsgNKFMSignal(int a)
{
__NK_ASSERT_DEBUG(TheScheduler.iCurrentThread->iHeldFastMutex==(NFastMutex*)a);
__KTRACE_OPT(KNKERN,DEBUGPRINT("NKFMSignal %M",a));
}
示例5: DebugMsgNKFMWaitYield
extern "C" void DebugMsgNKFMWaitYield(int a)
{
__KTRACE_OPT(KNKERN,DEBUGPRINT("NKFMWait: YieldTo %T",a));
}
示例6: __DebugMsgResched
extern "C" void __DebugMsgResched(int a)
{
__KTRACE_OPT(KSCHED,DEBUGPRINT("Reschedule->%T",a));
}
示例7: __DebugMsgBlockedFM
extern "C" void __DebugMsgBlockedFM(int a)
{
NFastMutex* pM=(NFastMutex*)a;
__KTRACE_OPT(KSCHED2,DEBUGPRINT("Resched inter->%T, Blocked on %M",pM->iHoldingThread,pM));
}
示例8: DEBUGPRINT
DWORD FFGLPluginDef::InitPluginLibrary()
{
DWORD rval = FF_FAIL;
if (m_mainfunc==NULL) {
DEBUGPRINT(("HEY! m_mainfunc is NULL in InitPluginLibrary!?"));
return rval;
}
//initialize the plugin
rval = m_mainfunc(FF_INITIALISE,0,0).ivalue;
if (rval!=FF_SUCCESS)
return rval;
//get the parameter names
m_numparams = (int)m_mainfunc(FF_GETNUMPARAMETERS, 0, 0).ivalue;
m_paramdefs = new FFGLParameterDef[m_numparams];
// DEBUGPRINT(("----- MALLOC new FFGLParameterDef"));
int n;
for (n=0; n<m_numparams; n++) {
plugMainUnion u = m_mainfunc(FF_GETPARAMETERNAME,(DWORD)n,0);
if (u.ivalue!=FF_FAIL && u.svalue!=NULL) {
//create a temporary copy as a cstring w/null termination
char newParamName[32];
const char *c = u.svalue;
char *t = newParamName;
//FreeFrame spec defines parameter names to be 16 characters long MAX
int numChars = 0;
while (*c && numChars<16) {
*t = *c;
t++;
c++;
numChars++;
}
//make sure there's a null at the end
*t = 0;
FFGLParameterDef* p;
p = SetParameterName(n, newParamName);
u = m_mainfunc(FF_GETPARAMETERTYPE,(DWORD)n,0);
p->type = u.ivalue;
u = m_mainfunc(FF_GETPARAMETERDEFAULT,(DWORD)n,0);
if ( p->type != FF_TYPE_TEXT ) {
p->default_float_val = u.fvalue;
DEBUGPRINT1(("Float Parameter n=%d s=%s type=%d default=%lf\n",
n,p->name.c_str(),p->type,p->default_float_val));
} else {
p->default_string_val = CopyFFString16(u.svalue);
DEBUGPRINT1(("String Parameter n=%d s=%s",n,p->name.c_str()));
}
p->num = n;
}
else
{
SetParameterName(n, "Untitled");
}
}
return FF_SUCCESS;
}
示例9: main
/// \brief Main program function
///
/// This function does very little on its own. It manages some output to
/// player's console, directs subsystems to initialize themselves and makes
/// choice of rendering engine. Then it runs the main game loop, processing
/// events and sending them further into the game.
int main(int argc, char *argv[])
{
#if !defined(WIN32) && !defined(__APPLE__)
#ifdef _GLIBCXX_DEBUG
/*#if __WORDSIZE != 64*/
/* Install our signal handler */
struct sigaction sa;
sa.sa_sigaction = /*(void *)*/crashhndl;
sigemptyset (&sa.sa_mask);
sa.sa_flags = SA_RESTART | SA_SIGINFO;
sigaction(SIGSEGV, &sa, NULL);
sigaction(SIGFPE, &sa, NULL);
/*#endif*/
#endif
#endif
#ifdef WIN32
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD( 2, 2 );
if(WSAStartup(wVersionRequested, &wsaData) != 0){
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "Winsock startup failed!!");
return -1;
}
if((LOBYTE(wsaData.wVersion) != 2) || (HIBYTE(wsaData.wVersion) != 2)){
WSACleanup( );
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "No Winsock 2.2 found!");
return -1;
}
#endif
//setenv("SDL_VIDEODRIVER", "aalib", 0);
//setenv("AAOPTS","-width 200 -height 70 -dim -reverse -bold -normal -boldfont -eight -extended ",0);
//setenv("AAFont","-*-fixed-bold-*-*-*-*-55-*-*-*-*-*-*",0);
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, PRODUCTLONG "\n");
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "================================\n");
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "version " PRODUCTVERSION "\n");
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "compiled on " __DATE__ " " __TIME__ "\n");
#ifdef BUILDVERSION
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "build %s\n", BUILDVERSION);
#endif
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, " This is free software: you are free to change and redistribute it.\n"
" There is NO WARRANTY, to the extent permitted by law. \n"
" Review LICENSE in " PRODUCTSHORT " distribution for details.\n");
yatc_fopen_init(argv[0]);
options.Load();
MAXFPS = options.maxfps;
#if HAVE_LIBINTL_H
// set up i18n stuff
if(options.lang.size())
{
std::string l("LANG=");
l+=options.lang;
putenv((char*)l.c_str());
std::string l2("LANGUAGE=");
l2+=options.lang;
putenv((char*)l2.c_str());
}
// Set default locale, e.g. from environment.
void * locale_result = setlocale(LC_ALL, "");
if (locale_result == NULL)
{
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "Failed to set locale to default.");
}
// Numbers should use default locale, always, to avoid sscanf() and similar problems.
setlocale(LC_NUMERIC, "C");
// Determine translation path. On Bazel builds, it's in runfiles.
#if !BAZEL_BUILD
std::string translations_path("./translations");
#else
std::string translations_path(yatc_path_to_binary() + "yatc.runfiles/yatc/translations");
#endif
DEBUGPRINT(DEBUGPRINT_LEVEL_OBLIGATORY, DEBUGPRINT_NORMAL, "Binding path for text domain 'yatc' to %s...\n", translations_path.c_str());
//.........这里部分代码省略.........
示例10: LEF_CliExec
void LEF_CliExec(void) {
DEBUGPRINT("Exec\n");
printCommands(Cmds);
cliLock=0;
printf(CLI_PROMPT);
}
示例11: DEBUGPRINT
int ControllerParser::handler(std::vector<std::string> commands, void *args)
{
Network::ControllerClient * l_cntlClient = (Network::ControllerClient *) args;
DEBUGPRINT("Entering handlers\n");
if (!commands.empty()) // grid parser
{
std::string command = commands.at(0);
if ( command == "GRID" && commands.size() >= 3)
{
const char * ipAddr = commands.at(1).c_str();
const char * port = commands.at(2).c_str();
printf("PARSED: Grid: IP=%s PORT=%s\n", ipAddr, port);
if (l_cntlClient->initGrid(ipAddr, port) < 0) return -1;
return (ipAddr != NULL && port != NULL)?0:-1;
}
if ( command == "CLOCK" && commands.size() >= 3)
{
const char * ipAddr = commands.at(1).c_str();
const char * port = commands.at(2).c_str();
printf("PARSED: Clock: IP=%s PORT=%s\n", ipAddr, port);
if (l_cntlClient->initClock(ipAddr, port) < 0) return -1;
return (ipAddr != NULL && port != NULL)?0:-1;
}
if ( command == "HOME_RADIUS" && commands.size() >= 2)
{
float radius = atof(commands.at(1).c_str());
printf("PARSED: Home radius: %f\n", radius);
l_cntlClient->setHomeRadius(radius);
return true;
}
if ( command == "WORLD_SIZE" && commands.size() >= 2)
{
float worldSize = atof(commands.at(1).c_str());
printf("PARSED: World size: %f\n", worldSize);
l_cntlClient->setWorldSize(worldSize);
return true;
}
if ( command == "NUM_GRIDS" && commands.size() >= 2)
{
int gridSize = atoi(commands.at(1).c_str());
printf("PARSED: Number of grids: %i\n", gridSize);
l_cntlClient->numGrids(gridSize);
return true;
}
if ( command == "PUCK_TOTAL" && commands.size() >= 2)
{
int pucks = atoi(commands.at(1).c_str());
printf("PARSED: Number of pucks: %i\n", pucks);
l_cntlClient->numPucksTotal(pucks);
return true;
}
if (command == "#")
{
DEBUGPRINT("Skipped Comment\n");
return 0;
}
printf("WARNING: command %s not found or malformed\n", command.c_str());
return 0;
}
return -1;
}
示例12: lookup_callback
static void lookup_callback (void *arg, struct nfs_client *client,
LOOKUP3res *result)
{
LOOKUP3resok *resok = &result->LOOKUP3res_u.resok;
err_t r;
struct http_cache_entry *e = arg;
DEBUGPRINT ("inside lookup_callback_file for file %s\n", e->name);
assert(result != NULL );
/* initiate a read for every regular file */
if ( result->status == NFS3_OK &&
resok->obj_attributes.attributes_follow &&
resok->obj_attributes.post_op_attr_u.attributes.type == NF3REG) {
/* FIXME: check if the file is recently modified or not. */
// resok->obj_attributes.post_op_attr_u.attributes.ctime;
DEBUGPRINT("Copying %s of size %lu\n", e->name,
resok->obj_attributes.post_op_attr_u.attributes.size );
/* Store the nfs directory handle in current_session (cs) */
nfs_copyfh (&e->file_handle, resok->object);
/* GLOBAL: Storing the global reference for cache entry */
/* NOTE: this memory is freed in reset_cache_entry() */
/* Allocate memory for holding the file-content */
/* Allocate the buff_holder */
e->hbuff = allocate_buff_holder(
resok->obj_attributes.post_op_attr_u.attributes.size );
/* NOTE: this memory will be freed by decrement_buff_holder_ref */
/* increment buff_holder reference */
increment_buff_holder_ref (e->hbuff);
e->hbuff->len = resok->obj_attributes.post_op_attr_u.attributes.size;
/* Set the size of the how much data is read till now. */
e->copied = 0;
r = nfs_read (client, e->file_handle, 0, MAX_NFS_READ,
read_callback, e);
assert (r == ERR_OK);
// free arguments
xdr_LOOKUP3res(&xdr_free, result);
return;
}
/* Most probably the file does not exist */
DEBUGPRINT ("Error: file [%s] does not exist, or wrong type\n", e->name);
#ifdef PRELOAD_WEB_CACHE
if (cache_loading_phase){
++cache_loading_probs;
handle_cache_load_done();
return;
}
#endif // PRELOAD_WEB_CACHE
if (e->conn == NULL) {
/* No connection is waiting for this loading */
return;
}
/* as file does not exist, send all the http_conns to error page. */
error_cache->conn = e->conn;
error_cache->last = e->last;
handle_pending_list (error_cache); /* done! */
/* free this cache entry as it is pointing to invalid page */
e->conn = NULL;
e->last = NULL;
delete_cacheline_from_cachelist (e);
if (e->name != NULL ) free(e->name);
free(e);
// free arguments
xdr_LOOKUP3res(&xdr_free, result);
return;
} /* end function: lookup_callback_file */
示例13: main
int main(int argc, char** argv)
{
setbuf(stdout, NULL);
if (argc <3)
{
printf("Usage: ./client.bin -f <init_file>\n");
return -1;
}
int l_res = 0;
char * l_filename = NULL;
while( (l_res = getopt(argc, argv, "f:")) != -1)
{
switch(l_res)
{
case('f'):
{
l_filename = optarg;
DEBUGPRINT("Prepairing to load init file: %s\n", l_filename);
break;
}
case('?'):
{
printf("Invalid paramater provided -%i\n", optopt);
printf("Usage: ./client.bin -f <init_file>\n");
break;
}
default:
{
abort();
break;
}
}
}
Network::RobotClient * l_rclient = new Network::RobotClient;
l_rclient->init();
RobotParser l_parser;
l_res = 0;
DEBUGPRINT("About to readfile\n");
if ((l_res = l_parser.readFile(l_filename, (void *)l_rclient )) == ENOENT)
{
printf("Error with parsing file: %s\n", l_filename);
return -1;
}
if (l_res < 0)
{
printf("Failed to parse file\n");
return -1;
}
DEBUGPRINT("Done reading files\n");
l_rclient->initRobotGame();
l_rclient->start();
return 0;
}
示例14: SendPosition
bool Engine::Network::CNetworkEngine::Update()
{
if (m_bHost)
{
Engine::CActor* pcPlayer = m_pcWorld->GetActorByName("PlayerCube");
float fNewLocationX = pcPlayer->GetMetricMember("LocationX");
float fNewLocationY = pcPlayer->GetMetricMember("LocationY");
float fNewLocationZ = pcPlayer->GetMetricMember("LocationZ");
SendPosition(fNewLocationX, fNewLocationY, fNewLocationZ);
float fNewRotationX = pcPlayer->GetMetricMember("RotationX");
float fNewRotationY = pcPlayer->GetMetricMember("RotationY");
float fNewRotationZ = pcPlayer->GetMetricMember("RotationZ");
SendRotation(fNewRotationX, fNewRotationY, fNewRotationZ);
//Engine::CActor* pcScoreZone1 = m_pcWorld->GetActorByName("ScoreZone1");
//float fScore = pcScoreZone1->GetMetricMember("Score");
//SendScore(fScore);
float fStamina = pcPlayer->GetMetricMember("Stamina");
SendStamina(fStamina);
float fWalk = pcPlayer->GetMetricMember("SoundWalk");
float fSurface = pcPlayer->GetMetricMember("LastHitSurface");
SendSoundWalk(fWalk == 0.0f ? false : true, fSurface);
float fSprint = pcPlayer->GetMetricMember("SoundSprint");
SendSoundSprint(fSprint == 0.0f ? false : true);
}
else
{
Engine::CActor* pcPlayer2 = m_pcWorld->GetActorByName("PlayerCube2");
float fNewLocationX = pcPlayer2->GetMetricMember("LocationX");
float fNewLocationY = pcPlayer2->GetMetricMember("LocationY");
float fNewLocationZ = pcPlayer2->GetMetricMember("LocationZ");
SendPosition(fNewLocationX, fNewLocationY, fNewLocationZ);
float fNewRotationX = pcPlayer2->GetMetricMember("RotationX");
float fNewRotationY = pcPlayer2->GetMetricMember("RotationY");
float fNewRotationZ = pcPlayer2->GetMetricMember("RotationZ");
SendRotation(fNewRotationX, fNewRotationY, fNewRotationZ);
//Engine::CActor* pcScoreZone2 = m_pcWorld->GetActorByName("ScoreZone2");
//float fScore = pcScoreZone2->GetMetricMember("Score");
//SendScore(fScore);
float fStamina = pcPlayer2->GetMetricMember("Stamina");
SendStamina(fStamina);
float fWalk = pcPlayer2->GetMetricMember("SoundWalk");
float fSurface = pcPlayer2->GetMetricMember("LastHitSurface");
SendSoundWalk(fWalk == 0.0f ? false : true, fSurface);
float fSprint = pcPlayer2->GetMetricMember("SoundSprint");
SendSoundSprint(fSprint == 0.0f ? false : true);
}
for (m_pcPacket = m_pcPeer->Receive(); m_pcPacket; m_pcPeer->DeallocatePacket(m_pcPacket), m_pcPacket = m_pcPeer->Receive())
{
switch (m_pcPacket->data[0])
{
case ID_REMOTE_DISCONNECTION_NOTIFICATION:
DEBUGPRINT("Another client has disconnected.\n");
m_bConnected = false;
break;
case ID_REMOTE_CONNECTION_LOST:
DEBUGPRINT("Another client has lost the connection.\n");
break;
case ID_REMOTE_NEW_INCOMING_CONNECTION:
DEBUGPRINT("Another client has connected.\n");
m_bConnected = true;
break;
case ID_CONNECTION_REQUEST_ACCEPTED:
{
DEBUGPRINT("Our connection request has been accepted.\n");
m_bConnected = true;
//.........这里部分代码省略.........
示例15: DEBUGPRINT
//thread to listen for connect requests
void *AgentListenThread(void *arg)
{
pthread_t rxThread[MAX_AGENT_CONNECTIONS];
struct sockaddr client_address;
socklen_t client_address_len;
//initialize the data structures
{
for (int i=0; i<MAX_AGENT_CONNECTIONS; i++)
{
rxSocket[i] = -1;
txSocket[i] = -1;
rxThread[i] = (pthread_t) -1;
connected[i] = false;
}
}
DEBUGPRINT("agent: Listen thread\n");
//create listen socket
int listenSocket;
while ((listenSocket = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
ERRORPRINT("agent: socket() error: %s\n", strerror(errno));
sleep(1);
}
int optval = 1;
setsockopt(listenSocket, SOL_SOCKET, SO_REUSEADDR, &optval, 4);
DEBUGPRINT("agent: listen socket created\n");
//bind socket address
struct sockaddr_in my_address;
memset(&my_address, 0, sizeof(my_address));
my_address.sin_family = AF_INET;
my_address.sin_port = htons(LISTEN_PORT_NUMBER);
my_address.sin_addr.s_addr = INADDR_ANY;
while (bind(listenSocket, (struct sockaddr*) &my_address, sizeof(my_address)) == -1)
{
ERRORPRINT("agent: bind() error: %s\n", strerror(errno));
if (errno == EADDRINUSE) sleep(10);
sleep(1);
}
DEBUGPRINT("agent: listen socket ready\n");
while(1)
{
//wait for connect
while(listen(listenSocket, 2) != 0)
{
ERRORPRINT("agent: listen() error %s\n", strerror(errno));
sleep(1);
//ignore errors, just retry
}
client_address_len = sizeof(client_address);
int acceptSocket = accept(listenSocket, &client_address, &client_address_len);
if (acceptSocket >= 0)
{
//print the address
struct sockaddr_in *client_address_in = (struct sockaddr_in *) &client_address;
uint8_t addrBytes[4];
memcpy(addrBytes, &client_address_in->sin_addr.s_addr, 4);
DEBUGPRINT("agent: connect from %i.%i.%i.%i\n", addrBytes[0], addrBytes[1], addrBytes[2], addrBytes[3]);
//find a free thread
int i;
int channel = -1;
for (i=0; i<MAX_AGENT_CONNECTIONS; i++)
{
if (!connected[i])
{
channel = i;
break;
}
}
if (channel < 0)
{
pthread_mutex_unlock(&agentMtx);
DEBUGPRINT("agent: no available server context\n");
}
else
{
rxSocket[channel] = acceptSocket;
txSocket[channel] = dup(acceptSocket); //separate rx & tx sockets
//create agent Rx thread
//.........这里部分代码省略.........