mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-07-31 01:15:48 -04:00
this is a more "clean" conversion to 64 bit than the type-fixups branch, which does borrow some elements from it but has far less find and replace...it is about 98-99% done, notes to follow later
This commit is contained in:
+3
-3
@@ -19,7 +19,7 @@ namespace GenericAPI
|
||||
|
||||
|
||||
GenericAPICore::GenericAPICore(const char *host,
|
||||
short port,
|
||||
int16_t port,
|
||||
unsigned reqTimeout,
|
||||
unsigned reconnectTimeout,
|
||||
unsigned noDataTimeoutSecs,
|
||||
@@ -40,7 +40,7 @@ GenericAPICore::GenericAPICore(const char *host,
|
||||
}
|
||||
|
||||
GenericAPICore::GenericAPICore(const char *hosts[],
|
||||
const short port[],
|
||||
const int16_t port[],
|
||||
unsigned arraySize,
|
||||
unsigned reqTimeout,
|
||||
unsigned reconnectTimeout,
|
||||
@@ -90,7 +90,7 @@ GenericAPICore::~GenericAPICore()
|
||||
}
|
||||
}
|
||||
|
||||
void GenericAPICore::changeHostPort(unsigned connectionIndex, const char *host, short port)
|
||||
void GenericAPICore::changeHostPort(unsigned connectionIndex, const char *host, int16_t port)
|
||||
{
|
||||
if (connectionIndex <= m_serverConnections.size() - 1)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
friend class GenericAPI;
|
||||
|
||||
GenericAPICore(const char *host,
|
||||
short port,
|
||||
int16_t port,
|
||||
unsigned reqTimeout,
|
||||
unsigned reconnectTimeout,
|
||||
unsigned noDataTimeoutSecs = 5,
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
* ALSO: cannot specify a 0 array size.
|
||||
*/
|
||||
GenericAPICore(const char *hosts[],
|
||||
const short port[],
|
||||
const int16_t port[],
|
||||
unsigned arraySize,
|
||||
unsigned reqTimeout,
|
||||
unsigned reconnectTimeout,
|
||||
@@ -60,21 +60,21 @@ public:
|
||||
|
||||
void process();
|
||||
#ifdef USE_SERIALIZE_LIB
|
||||
virtual void responseCallback(short type, const unsigned char *data, unsigned dataLen) = 0;
|
||||
virtual void responseCallback(int16_t type, const unsigned char *data, unsigned dataLen) = 0;
|
||||
#else
|
||||
virtual void responseCallback(short type, Base::ByteStream::ReadIterator &iter) = 0;
|
||||
virtual void responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter) = 0;
|
||||
#endif
|
||||
virtual void responseCallback(GenericResponse *R) = 0;
|
||||
|
||||
virtual void OnDisconnect(const char *host, short port) = 0;
|
||||
virtual void OnConnect(const char *host, short port) = 0;
|
||||
virtual void OnDisconnect(const char *host, int16_t port) = 0;
|
||||
virtual void OnConnect(const char *host, int16_t port) = 0;
|
||||
|
||||
void suspendProcessing() { m_suspended = true; }
|
||||
void resumeProcessing() { m_suspended = false; }
|
||||
|
||||
// change the host and port for a connection object, will take effect
|
||||
// on connection's next CON_DISCONNECT state.
|
||||
void changeHostPort(unsigned connectionIndex, const char *host, short port);
|
||||
void changeHostPort(unsigned connectionIndex, const char *host, int16_t port);
|
||||
|
||||
unsigned submitRequest(GenericRequest *req, GenericResponse *res);
|
||||
unsigned submitRequest(GenericRequest *req, GenericResponse *res, unsigned reqTimeout);
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ namespace NAMESPACE
|
||||
|
||||
unsigned GenericConnection::ms_crcBytes = 0;
|
||||
|
||||
GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime)
|
||||
GenericConnection::GenericConnection(const char *host, int16_t port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB, unsigned holdTime)
|
||||
: m_bConnected(false),
|
||||
m_apiCore(apiCore),
|
||||
m_con(nullptr),
|
||||
@@ -74,7 +74,7 @@ namespace NAMESPACE
|
||||
m_manager->Release();
|
||||
}
|
||||
|
||||
void GenericConnection::changeHostPort(const char *host, short port)
|
||||
void GenericConnection::changeHostPort(const char *host, int16_t port)
|
||||
{
|
||||
if (host &&
|
||||
strcmp(host, "") != 0)
|
||||
@@ -118,7 +118,7 @@ namespace NAMESPACE
|
||||
void GenericConnection::OnRoutePacket(UdpConnection *con, const unsigned char *data, int dataLen)
|
||||
#endif
|
||||
{
|
||||
short type;
|
||||
int16_t type;
|
||||
unsigned track;
|
||||
|
||||
#ifdef USE_SERIALIZE_LIB
|
||||
|
||||
+4
-4
@@ -36,7 +36,7 @@ namespace GenericAPI
|
||||
{
|
||||
public:
|
||||
GenericConnection(const char *host,
|
||||
short port,
|
||||
int16_t port,
|
||||
GenericAPICore *apiCore,
|
||||
unsigned reconnectTimeout,
|
||||
unsigned noDataTimeoutSecs = 5,
|
||||
@@ -63,7 +63,7 @@ namespace GenericAPI
|
||||
#endif
|
||||
|
||||
|
||||
void changeHostPort(const char *host, short port);
|
||||
void changeHostPort(const char *host, int16_t port);
|
||||
bool isConnected() { return m_bConnected; }
|
||||
void disconnect();
|
||||
void process(bool giveTime = true);
|
||||
@@ -81,8 +81,8 @@ namespace GenericAPI
|
||||
#endif
|
||||
std::string m_host;
|
||||
std::string m_nextHost;
|
||||
short m_port;
|
||||
short m_nextPort;
|
||||
int16_t m_port;
|
||||
int16_t m_nextPort;
|
||||
|
||||
unsigned m_lastTrack;
|
||||
|
||||
|
||||
+3
-3
@@ -6,17 +6,17 @@ namespace NAMESPACE
|
||||
#endif
|
||||
namespace GenericAPI
|
||||
{
|
||||
GenericMessage::GenericMessage(short type)
|
||||
GenericMessage::GenericMessage(int16_t type)
|
||||
: m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
GenericRequest::GenericRequest(short type)
|
||||
GenericRequest::GenericRequest(int16_t type)
|
||||
: GenericMessage(type)
|
||||
{
|
||||
}
|
||||
|
||||
GenericResponse::GenericResponse(short type, unsigned result, void *user)
|
||||
GenericResponse::GenericResponse(int16_t type, unsigned result, void *user)
|
||||
: GenericMessage(type),
|
||||
m_result(result),
|
||||
m_user(user),
|
||||
|
||||
@@ -16,18 +16,18 @@ namespace GenericAPI
|
||||
class GenericMessage
|
||||
{
|
||||
public:
|
||||
GenericMessage(short type);
|
||||
GenericMessage(int16_t type);
|
||||
virtual ~GenericMessage() {};
|
||||
|
||||
short getType() const { return m_type; }
|
||||
int16_t getType() const { return m_type; }
|
||||
protected:
|
||||
short m_type;
|
||||
int16_t m_type;
|
||||
};
|
||||
|
||||
class GenericRequest : public GenericMessage
|
||||
{
|
||||
public:
|
||||
GenericRequest(short type);
|
||||
GenericRequest(int16_t type);
|
||||
virtual ~GenericRequest() {};
|
||||
#ifdef USE_SERIALIZE_LIB
|
||||
virtual const unsigned char *pack(unsigned &msgSize) = 0;
|
||||
@@ -54,7 +54,7 @@ protected:
|
||||
class GenericResponse : public GenericMessage
|
||||
{
|
||||
public:
|
||||
GenericResponse(short type, unsigned result, void *user);
|
||||
GenericResponse(int16_t type, unsigned result, void *user);
|
||||
virtual ~GenericResponse() {};
|
||||
#ifdef USE_SERIALIZE_LIB
|
||||
virtual void unpack(const unsigned char *data, unsigned dataLen) = 0;
|
||||
|
||||
Reference in New Issue
Block a user