我的服务器有一个问题,它在调试器上运行。
当调用delete []指针时,我收到SIGTRAP消息。
编程接收信号SIGTRAP,跟踪/断点陷阱。在 ntdll!DbgUiConnectToDbg()(C:\ WINDOWS \ system32 \ ntdll.dll)
Character中的10 0x00402247 ::运行(此= 0x3e8170)F:\ EternalHeroes \ server \ src \ game \ handler \ CharacterCreateHandler.cpp:44
F:\ EternalHeroes \服务器\ SRC \游戏\处理程序\ CharacterCreateHandler.cpp:44:1211:BEG:0x402247 在 F:\ EternalHeroes \服务器\ SRC \游戏\处理程序\ CharacterCreateHandler.cpp:44
以下是发生的功能:
void CharacterCreateHandler::run()
{
try
{
unsigned short lenWOH = _packet[0] - 8;
Decryptor dec;
_packet = dec.decrypt(_packet + 8, lenWOH);
std::string characterName(_packet, 16);
Application & app = Application::instance();
app.logger().information(characterName);
unsigned short len = 20;
char * reply = new char[len]();
///build packet header
//set len (it's short)
reply[0] = len & 0xff;
reply[1] = (len >> 8) & 0xff;
reply[4] = 3; //group
reply[6] = 6; //type
///body - static
reply[8] = 1; //indicator
reply[9] = 1; //indicator
reply[10] = 0x12;
reply[11] = 0x2b;
reply[13] = 0xc0;
reply[14] = 0xb7;
reply[15] = 0xc4;
reply[17] = 0xe0;
reply[18] = 0x21;
reply[19] = 0x45;
_con->sendBlocking(reply, len);
delete [] _packet; //line 44
delete [] reply;
delete this;
}
catch(...)
{
}
}
这是给出指针的类表单(_pBuffer):
class CSConnection
{
public:
CSConnection(StreamSocket& socket, SocketReactor& reactor);
~CSConnection();
void sendBlocking(char * buffer, unsigned short len);
void sendNonblocking(char * buffer, unsigned short len);
void onReadable(const AutoPtr<ReadableNotification>& pNf);
void onSocketTimeout(const AutoPtr<TimeoutNotification>& pNf);
void onShutdown(const AutoPtr<ShutdownNotification>& pNf);
void onError(const AutoPtr<ErrorNotification>& pNf);
private:
enum
{
BUFFER_SIZE = 1024
};
StreamSocket _socket;
SocketReactor& _reactor;
char* _pBuffer;
};
功能什么接收包(_pBuffer)
void CSConnection::onReadable(const AutoPtr<ReadableNotification>& pNf)
{
try
{
int n = _socket.receiveBytes(_pBuffer, BUFFER_SIZE);
if (n > 0)
{
//app.logger().information("Packet s " + nb.format(nBytes) + ", group : " + nb.format(_pBuffer[4]) + ", type : " + nb.format(_pBuffer[6]));
unsigned short packetID;
packetID = (_pBuffer[4] * 666) + _pBuffer[6];
switch(packetID)
{
case 666:
WorkerThreadPool::getInstance().tp->start(*new QuitHandler(this));
break;
case 672:
WorkerThreadPool::getInstance().tp->start(*new CharacterCreateHandler(this, _pBuffer));
break;
...