implemented packet queue to write a report on network error

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3829 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
driAn
2008-12-02 20:35:17 +00:00
parent 1372f52f02
commit 46325eca7d
4 changed files with 22 additions and 0 deletions
+3
View File
@@ -414,6 +414,9 @@ void gets2c() // get updates from the server
break;
case ENET_EVENT_TYPE_RECEIVE:
extern packetqueue pkglogger;
pkglogger.queue(*event.packet);
if(discmillis) conoutf("attempting to disconnect...");
else servertoclient(event.channelID, event.packet->data, (int)event.packet->dataLength);
enet_packet_destroy(event.packet);
+4
View File
@@ -10,9 +10,13 @@ VARP(networkdebug, 0, 0, 1);
extern bool c2sinit, senditemstoserver, watchingdemo;
extern string clientpassword;
packetqueue pkglogger(8);
void neterr(const char *s)
{
conoutf("\f3illegal network message (%s)", s);
pkglogger.flushtolog("packetlog.txt");
conoutf("\f3wrote network error report to packetlog.txt, please post this file to the bugtracker now!");
disconnect();
}
+1
View File
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <queue>
#include <ctype.h>
#include <time.h>
#include <limits.h>
+14
View File
@@ -208,6 +208,20 @@ extern serverinfo *getconnectedserverinfo();
extern void pingservers();
extern void updatefrommaster(int force);
class packetqueue
{
size_t queuesize;
std::queue<ENetPacket> pqueue;
public:
packetqueue(size_t size);
~packetqueue();
void queue(ENetPacket &p);
bool flushtolog(char *logfile);
void clear();
};
// rendergl
extern glmatrixf mvmatrix, projmatrix, clipmatrix, mvpmatrix, invmvmatrix, invmvpmatrix;
extern void resetcamera();