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

debug

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