diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/connection.cpp | 5 | ||||
-rw-r--r-- | src/network/packethandlers/client.cpp | 8 | ||||
-rw-r--r-- | src/network/packethandlers/server.cpp | 6 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/network/connection.cpp b/src/network/connection.cpp index fb31a07f0..69deb4dd5 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -1725,9 +1725,8 @@ void ConnectionSendThread::connect(Address address) // Send a dummy packet to server with peer_id = PEER_ID_INEXISTENT m_connection->SetPeerID(PEER_ID_INEXISTENT); - NetworkPacket* pkt = new NetworkPacket(0,0); - m_connection->Send(PEER_ID_SERVER, 0, pkt, true); - delete pkt; + NetworkPacket pkt(0,0); + m_connection->Send(PEER_ID_SERVER, 0, &pkt, true); } void ConnectionSendThread::disconnect() diff --git a/src/network/packethandlers/client.cpp b/src/network/packethandlers/client.cpp index 838c85989..5acf04f91 100644 --- a/src/network/packethandlers/client.cpp +++ b/src/network/packethandlers/client.cpp @@ -77,8 +77,8 @@ void Client::handleCommand_AuthAccept(NetworkPacket* pkt) << m_recommended_send_interval<<std::endl; // Reply to server - NetworkPacket* resp_pkt = new NetworkPacket(TOSERVER_INIT2, 0); - Send(resp_pkt); + NetworkPacket resp_pkt(TOSERVER_INIT2, 0); + Send(&resp_pkt); m_state = LC_Init; } @@ -128,8 +128,8 @@ void Client::handleCommand_InitLegacy(NetworkPacket* pkt) } // Reply to server - NetworkPacket* resp_pkt = new NetworkPacket(TOSERVER_INIT2, 0); - Send(resp_pkt); + NetworkPacket resp_pkt(TOSERVER_INIT2, 0); + Send(&resp_pkt); m_state = LC_Init; } diff --git a/src/network/packethandlers/server.cpp b/src/network/packethandlers/server.cpp index ee30dfd06..9070be356 100644 --- a/src/network/packethandlers/server.cpp +++ b/src/network/packethandlers/server.cpp @@ -617,14 +617,14 @@ void Server::handleCommand_Init_Legacy(NetworkPacket* pkt) Answer with a TOCLIENT_INIT */ - NetworkPacket* resp_pkt = new NetworkPacket(TOCLIENT_INIT_LEGACY, 1 + 6 + 8 + 4, + NetworkPacket resp_pkt(TOCLIENT_INIT_LEGACY, 1 + 6 + 8 + 4, pkt->getPeerId()); - *resp_pkt << (u8) deployed << (v3s16) floatToInt(v3f(0,0,0), BS) + resp_pkt << (u8) deployed << (v3s16) floatToInt(v3f(0,0,0), BS) << (u64) m_env->getServerMap().getSeed() << g_settings->getFloat("dedicated_server_step"); - Send(resp_pkt); + Send(&resp_pkt); m_clients.event(pkt->getPeerId(), CSE_Init); } |