syncTcp.h 1.3 KB
Newer Older
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

S
Shengliang Guan 已提交
16 17
#ifndef TDENGINE_SYNC_TCP_POOL_H
#define TDENGINE_SYNC_TCP_POOL_H
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
18 19 20 21 22 23

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
S
TD-1848  
Shengliang Guan 已提交
24
  int32_t   numOfThreads;
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
25
  uint32_t  serverIp;
26
  int16_t   port;
S
TD-1848  
Shengliang Guan 已提交
27
  int32_t   bufferSize;
S
TD-2524  
Shengliang Guan 已提交
28 29
  void    (*processBrokenLink)(int64_t handleId);
  int32_t (*processIncomingMsg)(int64_t handleId, void *buffer);
30
  void    (*processIncomingConn)(SOCKET fd, uint32_t ip);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
31 32
} SPoolInfo;

S
Shengliang Guan 已提交
33 34
void *syncOpenTcpThreadPool(SPoolInfo *pInfo);
void  syncCloseTcpThreadPool(void *);
35
void *syncAllocateTcpConn(void *, int64_t rid, SOCKET connFd);
S
Shengliang Guan 已提交
36
void  syncFreeTcpConn(void *);
陶建辉(Jeff)'s avatar
陶建辉(Jeff) 已提交
37 38 39 40 41 42 43

#ifdef __cplusplus
}
#endif

#endif  // TDENGINE_TCP_POOL_H