@@ -12,12 +12,14 @@
#ifndef NETWORK_CORE_TCP_H
#define NETWORK_CORE_TCP_H
#include "address.h"
#include "packet.h"
#include <atomic>
/** The states of sending the packets. */
enum SendPacketsState {
SPS_CLOSED, ///< The connection got closed.
SPS_NONE_SENT, ///< The buffer is still full, so no (parts of) packets could be sent.
SPS_PARTLY_SENT, ///< The packets are partly sent; there are more packets to be sent in the queue.
SPS_ALL_SENT, ///< All packets in the queue are sent.
@@ -58,14 +60,14 @@ public:
/**
* "Helper" class for creating TCP connections in a non-blocking manner
*/
class TCPConnecter {
private:
bool connected; ///< Whether we succeeded in making the connection
bool aborted; ///< Whether we bailed out (i.e. connection making failed)
std::atomic<bool> connected;///< Whether we succeeded in making the connection
std::atomic<bool> aborted; ///< Whether we bailed out (i.e. connection making failed)
bool killed; ///< Whether we got killed
SOCKET sock; ///< The socket we're connecting with
void Connect();
static void ThreadEntry(TCPConnecter *param);