/** * Initialize the socketBuffer module */ void SocketBuffer_initialize(void) { FUNC_ENTRY; SocketBuffer_newDefQ(); queues = ListInitialize(); ListZero(&writes); FUNC_EXIT; }
RTTcp::RTTcp() : Task() , fTimeoutTask(NULL, 10 * 1000) , fSocket(NULL, Socket::kNonBlockingSocketType) , fTickTime(0) { ListZero(&m_listSend); fSessionID = (UInt32)atomic_add(&sSessionIDCounter, 1); fTimeoutTask.SetTask(this); fSocket.SetTask(this); }
SslTcpClient::SslTcpClient(ApsApnsClientPool* pool) : TcpClient(NULL) , fTcpSocket(new SslTcpClientSocket(Socket::kNonBlockingSocketType)) , m_clientPool(pool) { memset(fUserTypeBuf, 0, kMaxUserTypeLen); memset(fUserNameBuf, 0, kMaxUserNameLen); memset(fUserPasswordBuf, 0, kMaxUserPasswordLen); memset(fUserAppName, 0, kMaxUserParamLen); memset(fUserDevId, 0, kMaxUserParamLen); memset(fUserRealmBuf, 0, kMaxUserParamLen); fTaskQueueElem.SetEnclosingObject(this); ListZero(&fMsgList); SetClientSocket(fTcpSocket); // fTcpSocket = new SslTcpClientSocket(Socket::kNonBlockingSocketType); ApsLogger::Debug("SslTcpClient This = %x!",this); SetTimeout(30*60*1000); }
SslSvrSession::SslSvrSession(int fd,struct sockaddr_in *addr,SSL_CTX *m_pctx) : TCPSslSessionInterface(fd,addr), fState(kReadingRequest) { fInputStream.ShowTCP(true); ListZero(&fMsgList); // 创建当前连接的SSL结构体 m_pssl = SSL_new(m_pctx); // 将SSL绑定到套接字上 SSL_set_fd(m_pssl, fd); // SSL_set_verify(m_pssl, SSL_VERIFY_PEER,NULL); // 接受SSL连接 SSL_accept(m_pssl); // 获取和释放客户端证书 // 这一步是可选的 m_pserver_cert = SSL_get_peer_certificate(m_pssl); appId = "1234567890"; X509_free(m_pserver_cert); }
/** * Allocates and initializes a new list structure. * @return a pointer to the new list structure */ List* ListInitialize(void) { List* newl = malloc(sizeof(List)); ListZero(newl); return newl; }