From: Keith F. <ven...@us...> - 2003-03-02 07:56:20
|
Update of /cvsroot/planeshift/planeshift/src/common/net In directory sc8-pr-cvs1:/tmp/cvs-serv29905 Modified Files: netbase.cpp Log Message: Added a message to marshall the spawning parameters so that Spawnmanager can switch threads and do it's spawning in the main CS thread. Added an API to MsgHandler to allow callers to add MsgEntry's to the queue directly, which allows them to be picked up and published by the other thread. Index: netbase.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/common/net/netbase.cpp,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** netbase.cpp 1 Mar 2003 02:24:52 -0000 1.100 --- netbase.cpp 2 Mar 2003 07:56:16 -0000 1.101 *************** *** 720,723 **** --- 720,740 ---- } + void NetBase::QueueMessage(MsgEntry *me) + { + for (int i=0;i<maxinqueues;i++) + { + if (InQueues[i]) + { + me->IncRef(); // psMessages are refcounted. psNetPackets are not. + if (!InQueues[i]->Add(me)) + { + printf ("*** Input Buffer Full! Dropping packet of type %d!\n",me->data->type); + CHECK_FINAL_DECREF(me,"Dropped msg"); + me->DecRef(); + } + } + } + } + void NetBase::HandleCompletedMessage(MsgEntry *me, Connection* &connection, LPSOCKADDR_IN addr) *************** *** 748,764 **** // put the message in the queue me->clientnum = connection->clientnum; ! for (int i=0;i<maxinqueues;i++) ! { ! if (InQueues[i]) ! { ! me->IncRef(); // psMessages are refcounted. psNetPackets are not. ! if (!InQueues[i]->Add(me)) ! { ! printf ("*** Input Buffer Full! Dropping packet of type %d!\n",me->data->type); ! CHECK_FINAL_DECREF(me,"Dropped msg"); ! me->DecRef(); ! } ! } ! } } --- 765,769 ---- // put the message in the queue me->clientnum = connection->clientnum; ! QueueMessage(me); } |