diff --git a/src/inc/trpc.h b/src/inc/trpc.h index 3388f0c6c79a7ed3af013eeaeb31b09f41daf4d0..121bb183827fdb8205c56524470929cabe41e0a7 100644 --- a/src/inc/trpc.h +++ b/src/inc/trpc.h @@ -51,20 +51,20 @@ typedef struct { int connType; // TAOS_CONN_UDP, TAOS_CONN_TCPC, TAOS_CONN_TCPS int idleTime; // milliseconds, 0 means idle timer is disabled - // the following is for client security only + // the following is for client app ecurity only char *user; // user name char spi; // security parameter index char encrypt; // encrypt algorithm char *secret; // key for authentication char *ckey; // ciphering key - // call back to process incoming msg - void (*cfp)(char type, void *pCont, int contLen, void *ahandle, int32_t code); + // call back to process incoming msg, code shall be ignored by server app + void (*cfp)(char type, void *pCont, int contLen, void *handle, int32_t code); - // call back to process notify the ipSet changes + // call back to process notify the ipSet changes, for client app only void (*ufp)(void *ahandle, SRpcIpSet *pIpSet); - // call back to retrieve the client auth info + // call back to retrieve the client auth info, for server app only int (*afp)(char *meterId, char *spi, char *encrypt, char *secret, char *ckey); } SRpcInit; diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index a5e805791e2b4aa53c319d98eb3f79f6ae74d93b..ffac17cd70ce4a5e97df1f20e9ff897d85e00700 100755 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -49,9 +49,9 @@ typedef struct { int connType; char label[12]; - char user[TSDB_UNI_LEN]; // meter ID - char spi; // security parameter index - char encrypt; // encrypt algorithm + char user[TSDB_UNI_LEN]; // meter ID + char spi; // security parameter index + char encrypt; // encrypt algorithm char secret[TSDB_KEY_LEN]; // secret for the link char ckey[TSDB_KEY_LEN]; // ciphering key @@ -169,7 +169,7 @@ void (*taosCloseConn[])(void *chandle) = { static SRpcConn *rpcOpenConn(SRpcInfo *pRpc, char *peerIpStr, uint16_t peerPort, int8_t connType); static void rpcCloseConn(void *thandle); -static SRpcConn *rpcSetConnToServer(SRpcReqContext *pContext); +static SRpcConn *rpcSetupConnToServer(SRpcReqContext *pContext); static SRpcConn *rpcAllocateClientConn(SRpcInfo *pRpc); static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, char *user, char *hashstr); static SRpcConn *rpcGetConnObj(SRpcInfo *pRpc, int sid, char *user, char *hashstr); @@ -567,7 +567,7 @@ static SRpcConn *rpcGetConnObj(SRpcInfo *pRpc, int sid, char *user, char *hashst return pConn; } -SRpcConn *rpcSetConnToServer(SRpcReqContext *pContext) { +static SRpcConn *rpcSetupConnToServer(SRpcReqContext *pContext) { SRpcConn *pConn; SRpcInfo *pRpc = pContext->pRpc; SRpcIpSet *pIpSet = &pContext->ipSet; @@ -888,7 +888,7 @@ static void rpcSendReqToServer(SRpcInfo *pRpc, SRpcReqContext *pContext) { char msgType = pContext->msgType; pContext->numOfTry++; - SRpcConn *pConn = rpcSetConnToServer(pContext); + SRpcConn *pConn = rpcSetupConnToServer(pContext); if (pConn == NULL) { pContext->code = terrno; taosTmrStart(rpcProcessConnError, 0, pContext, pRpc->tmrCtrl); @@ -921,7 +921,7 @@ static void rpcSendReqToServer(SRpcInfo *pRpc, SRpcReqContext *pContext) { pthread_mutex_unlock(&pRpc->mutex); rpcSendMsgToPeer(pConn, msg, msgLen); - //taosTmrReset(rpcProcessRetryTimer, tsRpcTimer, pConn, pRpc->tmrCtrl, &pConn->pTimer); + taosTmrReset(rpcProcessRetryTimer, tsRpcTimer, pConn, pRpc->tmrCtrl, &pConn->pTimer); } static void rpcSendMsgToPeer(SRpcConn *pConn, void *msg, int msgLen) {