这篇教程C++ CloseSession函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CloseSession函数的典型用法代码示例。如果您正苦于以下问题:C++ CloseSession函数的具体用法?C++ CloseSession怎么用?C++ CloseSession使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CloseSession函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DoRead int DoRead(issl_session* session) { // Is this right? Not sure if the unencrypted data is garaunteed to be the same length. // Read into the inbuffer, offset from the beginning by the amount of data we have that insp hasn't taken yet. ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: SSL_read(sess, inbuf+%d, %d-%d)", session->inbufoffset, inbufsize, session->inbufoffset); int ret = SSL_read(session->sess, session->inbuf + session->inbufoffset, inbufsize - session->inbufoffset); if(ret == 0) { // Client closed connection. ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Client closed the connection"); CloseSession(session); return 0; } else if(ret < 0) { int err = SSL_get_error(session->sess, ret); if(err == SSL_ERROR_WANT_READ) { ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Not all SSL data read, need to retry: %s", get_error()); session->rstat = ISSL_READ; return -1; } else if(err == SSL_ERROR_WANT_WRITE) { ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Not all SSL data read but the damn thing wants to write instead: %s", get_error()); session->rstat = ISSL_WRITE; return -1; } else { ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Error reading SSL data: %s", get_error()); CloseSession(session); return 0; } } else { // Read successfully 'ret' bytes into inbuf + inbufoffset // There are 'ret' + 'inbufoffset' bytes of data in 'inbuf' // 'buffer' is 'count' long ServerInstance->Log(DEBUG, "m_ssl_openssl.so: DoRead: Read %d bytes, now have %d waiting to be passed up", ret, ret + session->inbufoffset); session->inbufoffset += ret; return ret; } }
开发者ID:mikebryant,项目名称:inspircd,代码行数:51,
示例2: Handshake bool Handshake(StreamSocket* user) { int ret; if (outbound) ret = SSL_connect(sess); else ret = SSL_accept(sess); if (ret < 0) { int err = SSL_get_error(sess, ret); if (err == SSL_ERROR_WANT_READ) { SocketEngine::ChangeEventMask(user, FD_WANT_POLL_READ | FD_WANT_NO_WRITE); this->status = ISSL_HANDSHAKING; return true; } else if (err == SSL_ERROR_WANT_WRITE) { SocketEngine::ChangeEventMask(user, FD_WANT_NO_READ | FD_WANT_SINGLE_WRITE); this->status = ISSL_HANDSHAKING; return true; } else { CloseSession(); } return false; } else if (ret > 0) { // Handshake complete. VerifyCertificate(); status = ISSL_OPEN; SocketEngine::ChangeEventMask(user, FD_WANT_POLL_READ | FD_WANT_NO_WRITE | FD_ADD_TRIAL_WRITE); return true; } else if (ret == 0) { CloseSession(); return true; } return true; }
开发者ID:FrostyCoolSlug,项目名称:inspircd,代码行数:51,
示例3: CloseSession void TcpNetwork::RunCheckSelectClients(fd_set& exc_set, fd_set& read_set, fd_set& write_set) { for (int i = 0; i < m_ClientSessionPool.size(); ++i) { auto& session = m_ClientSessionPool[i]; if (session.IsConnected() == false) { continue; } SOCKET fd = session.SocketFD; auto sessionIndex = session.Index; // check error if (FD_ISSET(fd, &exc_set)) { CloseSession(SOCKET_CLOSE_CASE::SELECT_ERROR, fd, sessionIndex); continue; } // check read auto retReceive = RunProcessReceive(sessionIndex, fd, read_set); if (retReceive == false) { continue; } // check write RunProcessWrite(sessionIndex, fd, write_set); } }
开发者ID:skdn159,项目名称:GameServerLearning,代码行数:30,
示例4: acceptNET_ERROR_CODE TcpNetwork::NewSession(){ SOCKADDR_IN client_addr; int client_len = static_cast<int>(sizeof(client_addr)); auto client_sockfd = accept(m_ServerSockfd, (SOCKADDR*)&client_addr, &client_len); if (client_sockfd < 0) { m_pRefLogger->Write(LOG_TYPE::L_ERROR, "%s | Wrong socket %d cannot accept", __FUNCTION__, client_sockfd); return NET_ERROR_CODE::ACCEPT_API_ERROR; } auto newSessionIndex = AllocClientSessionIndex(); //index pool C++ CloseSocket函数代码示例 C++ CloseServiceHandle函数代码示例
|