rename some structures
This commit is contained in:
parent
704d8da049
commit
e01081f275
|
@ -22,18 +22,18 @@
|
||||||
#include "tutil.h"
|
#include "tutil.h"
|
||||||
#include "rpcCache.h"
|
#include "rpcCache.h"
|
||||||
|
|
||||||
typedef struct _c_hash_t {
|
typedef struct SConnHash {
|
||||||
uint32_t ip;
|
uint32_t ip;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
char connType;
|
char connType;
|
||||||
struct _c_hash_t *prev;
|
struct SConnHash *prev;
|
||||||
struct _c_hash_t *next;
|
struct SConnHash *next;
|
||||||
void * data;
|
void *data;
|
||||||
uint64_t time;
|
uint64_t time;
|
||||||
} SConnHash;
|
} SConnHash;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SConnHash ** connHashList;
|
SConnHash **connHashList;
|
||||||
mpool_h connHashMemPool;
|
mpool_h connHashMemPool;
|
||||||
int maxSessions;
|
int maxSessions;
|
||||||
int total;
|
int total;
|
||||||
|
|
|
@ -17,13 +17,13 @@
|
||||||
#include "tlog.h"
|
#include "tlog.h"
|
||||||
#include "tmempool.h"
|
#include "tmempool.h"
|
||||||
|
|
||||||
typedef struct _ip_hash_t {
|
typedef struct SIpHash {
|
||||||
uint32_t ip;
|
uint32_t ip;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
int hash;
|
int hash;
|
||||||
struct _ip_hash_t *prev;
|
struct SIpHash *prev;
|
||||||
struct _ip_hash_t *next;
|
struct SIpHash *next;
|
||||||
void * data;
|
void *data;
|
||||||
} SIpHash;
|
} SIpHash;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -47,7 +47,7 @@ int rpcHashIp(void *handle, uint32_t ip, uint16_t port) {
|
||||||
|
|
||||||
void *rpcAddIpHash(void *handle, void *data, uint32_t ip, uint16_t port) {
|
void *rpcAddIpHash(void *handle, void *data, uint32_t ip, uint16_t port) {
|
||||||
int hash;
|
int hash;
|
||||||
SIpHash * pNode;
|
SIpHash *pNode;
|
||||||
SHashObj *pObj;
|
SHashObj *pObj;
|
||||||
|
|
||||||
pObj = (SHashObj *)handle;
|
pObj = (SHashObj *)handle;
|
||||||
|
@ -70,7 +70,7 @@ void *rpcAddIpHash(void *handle, void *data, uint32_t ip, uint16_t port) {
|
||||||
|
|
||||||
void rpcDeleteIpHash(void *handle, uint32_t ip, uint16_t port) {
|
void rpcDeleteIpHash(void *handle, uint32_t ip, uint16_t port) {
|
||||||
int hash;
|
int hash;
|
||||||
SIpHash * pNode;
|
SIpHash *pNode;
|
||||||
SHashObj *pObj;
|
SHashObj *pObj;
|
||||||
|
|
||||||
pObj = (SHashObj *)handle;
|
pObj = (SHashObj *)handle;
|
||||||
|
@ -102,7 +102,7 @@ void rpcDeleteIpHash(void *handle, uint32_t ip, uint16_t port) {
|
||||||
|
|
||||||
void *rpcGetIpHash(void *handle, uint32_t ip, uint16_t port) {
|
void *rpcGetIpHash(void *handle, uint32_t ip, uint16_t port) {
|
||||||
int hash;
|
int hash;
|
||||||
SIpHash * pNode;
|
SIpHash *pNode;
|
||||||
SHashObj *pObj;
|
SHashObj *pObj;
|
||||||
|
|
||||||
pObj = (SHashObj *)handle;
|
pObj = (SHashObj *)handle;
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
int tsUdpDelay = 0;
|
int tsUdpDelay = 0;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void * signature;
|
void *signature;
|
||||||
int index;
|
int index;
|
||||||
int fd;
|
int fd;
|
||||||
uint16_t port; // peer port
|
uint16_t port; // peer port
|
||||||
|
@ -53,23 +53,23 @@ typedef struct {
|
||||||
int server;
|
int server;
|
||||||
char ip[16]; // local IP
|
char ip[16]; // local IP
|
||||||
uint16_t port; // local Port
|
uint16_t port; // local Port
|
||||||
void * shandle; // handle passed by upper layer during server initialization
|
void *shandle; // handle passed by upper layer during server initialization
|
||||||
int threads;
|
int threads;
|
||||||
char label[12];
|
char label[12];
|
||||||
void * tmrCtrl;
|
void *tmrCtrl;
|
||||||
void *(*fp)(SRecvInfo *pPacket);
|
void *(*fp)(SRecvInfo *pPacket);
|
||||||
SUdpConn udpConn[];
|
SUdpConn udpConn[];
|
||||||
} SUdpConnSet;
|
} SUdpConnSet;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void * signature;
|
void *signature;
|
||||||
uint32_t ip; // dest IP
|
uint32_t ip; // dest IP
|
||||||
uint16_t port; // dest Port
|
uint16_t port; // dest Port
|
||||||
SUdpConn * pConn;
|
SUdpConn *pConn;
|
||||||
struct sockaddr_in destAdd;
|
struct sockaddr_in destAdd;
|
||||||
void * msgHdr;
|
void *msgHdr;
|
||||||
int totalLen;
|
int totalLen;
|
||||||
void * timer;
|
void *timer;
|
||||||
int emptyNum;
|
int emptyNum;
|
||||||
} SUdpBuf;
|
} SUdpBuf;
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ static SUdpBuf *taosCreateUdpBuf(SUdpConn *pConn, uint32_t ip, uint16_t port);
|
||||||
static void taosProcessUdpBufTimer(void *param, void *tmrId);
|
static void taosProcessUdpBufTimer(void *param, void *tmrId);
|
||||||
|
|
||||||
void *taosInitUdpConnection(char *ip, uint16_t port, char *label, int threads, void *fp, void *shandle) {
|
void *taosInitUdpConnection(char *ip, uint16_t port, char *label, int threads, void *fp, void *shandle) {
|
||||||
SUdpConn * pConn;
|
SUdpConn *pConn;
|
||||||
SUdpConnSet * pSet;
|
SUdpConnSet *pSet;
|
||||||
|
|
||||||
int size = (int)sizeof(SUdpConnSet) + threads * (int)sizeof(SUdpConn);
|
int size = (int)sizeof(SUdpConnSet) + threads * (int)sizeof(SUdpConn);
|
||||||
pSet = (SUdpConnSet *)malloc((size_t)size);
|
pSet = (SUdpConnSet *)malloc((size_t)size);
|
||||||
|
@ -164,7 +164,7 @@ void *taosInitUdpConnection(char *ip, uint16_t port, char *label, int threads, v
|
||||||
|
|
||||||
void taosCleanUpUdpConnection(void *handle) {
|
void taosCleanUpUdpConnection(void *handle) {
|
||||||
SUdpConnSet *pSet = (SUdpConnSet *)handle;
|
SUdpConnSet *pSet = (SUdpConnSet *)handle;
|
||||||
SUdpConn * pConn;
|
SUdpConn *pConn;
|
||||||
|
|
||||||
if (pSet == NULL) return;
|
if (pSet == NULL) return;
|
||||||
|
|
||||||
|
@ -205,10 +205,10 @@ void *taosOpenUdpConnection(void *shandle, void *thandle, char *ip, uint16_t por
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *taosRecvUdpData(void *param) {
|
static void *taosRecvUdpData(void *param) {
|
||||||
|
SUdpConn *pConn = param;
|
||||||
struct sockaddr_in sourceAdd;
|
struct sockaddr_in sourceAdd;
|
||||||
int dataLen;
|
int dataLen;
|
||||||
unsigned int addLen;
|
unsigned int addLen;
|
||||||
SUdpConn * pConn = (SUdpConn *)param;
|
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
int minSize = sizeof(SRpcHead);
|
int minSize = sizeof(SRpcHead);
|
||||||
SRecvInfo recvInfo;
|
SRecvInfo recvInfo;
|
||||||
|
@ -274,7 +274,7 @@ static void *taosRecvUdpData(void *param) {
|
||||||
|
|
||||||
int taosSendUdpData(uint32_t ip, uint16_t port, void *data, int dataLen, void *chandle) {
|
int taosSendUdpData(uint32_t ip, uint16_t port, void *data, int dataLen, void *chandle) {
|
||||||
SUdpConn *pConn = (SUdpConn *)chandle;
|
SUdpConn *pConn = (SUdpConn *)chandle;
|
||||||
SUdpBuf * pBuf;
|
SUdpBuf *pBuf;
|
||||||
|
|
||||||
if (pConn == NULL || pConn->signature != pConn) return -1;
|
if (pConn == NULL || pConn->signature != pConn) return -1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue