提交 8f40aef2 编写于 作者: C Cary Xu

debug

上级 af84d8db
......@@ -15,7 +15,6 @@
#ifndef TDENGINE_OS_SOCKET_H
#define TDENGINE_OS_SOCKET_H
#ifdef __cplusplus
extern "C" {
#endif
......@@ -33,13 +32,17 @@ extern "C" {
#define taosReadSocket(fd, buf, len) read(fd, buf, len)
#define taosWriteSocket(fd, buf, len) write(fd, buf, len)
#define taosCloseSocketNoCheck(x) close(x)
#define taosCloseSocket(x) \
{ \
if (FD_VALID(x)) { \
close(x); \
x = FD_INITIALIZER; \
} \
}
static FORCE_INLINE int32_t taosCloseSocket(int x) {
int32_t ret = 0;
if (x > STDERR_FILENO) {
ret = close(x);
x = ((int32_t)-1);
}
if (ret != 0) {
exit(10);
}
return ret;
}
#endif
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
......
......@@ -566,7 +566,10 @@ static void syncClosePeerConn(SSyncPeer *pPeer) {
sDebug("%s, pfd:%d sfd:%d will be closed", pPeer->id, pPeer->peerFd, pPeer->syncFd);
taosTmrStopA(&pPeer->timer);
taosCloseSocket(pPeer->syncFd);
if (taosCloseSocket(pPeer->syncFd) != 0) {
exit(4);
}
if (pPeer->peerFd >= 0) {
pPeer->peerFd = -1;
void *pConn = pPeer->pConn;
......@@ -892,7 +895,9 @@ static void syncRestartPeer(SSyncPeer *pPeer) {
int32_t ret = strcmp(pPeer->fqdn, tsNodeFqdn);
if (pPeer->nodeId == 0 || ret > 0 || (ret == 0 && pPeer->port > tsSyncPort)) {
sDebug("%s, check peer connection in 1000 ms", pPeer->id);
taosTmrReset(syncCheckPeerConnection, SYNC_CHECK_INTERVAL, (void *)pPeer->rid, tsSyncTmrCtrl, &pPeer->timer);
if (!taosTmrReset(syncCheckPeerConnection, SYNC_CHECK_INTERVAL, (void *)pPeer->rid, tsSyncTmrCtrl, &pPeer->timer)) {
exit(3);
}
}
}
......
......@@ -168,7 +168,9 @@ void syncFreeTcpConn(void *param) {
sDebug("%p TCP connection will be closed, fd:%d", pThread, pConn->fd);
pConn->closedByApp = 1;
shutdown(pConn->fd, SHUT_WR);
if (shutdown(pConn->fd, SHUT_WR) != 0) {
exit(2);
}
}
static void taosProcessBrokenLink(SConnObj *pConn) {
......
......@@ -445,6 +445,7 @@ bool taosTmrStop(tmr_h timerId) {
bool taosTmrStopA(tmr_h* timerId) {
bool ret = taosTmrStop(*timerId);
*timerId = NULL;
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册