Skip to content

Commit 69087bd

Browse files
committed
a
1 parent 169324b commit 69087bd

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

bsn_cpp/plug_base64/src/plug_base64.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
#include <bsn_cpp/include/new.hpp>
88
#include <bsn_cpp/include/delete.hpp>
99

10+
#include <boost/bind.hpp>
11+
1012
#include <cryptopp/base64.h>
1113

1214
#include <iostream>
1315
#include <string>
1416
#include <sstream>
1517

1618
using namespace std;
17-
using namespace boost::archive::iterators;
1819

1920
D_BsnNamespace1(plug_base64)
2021
//////////////////////////////////////////////////////////////////////
@@ -29,25 +30,25 @@ C_PlugBase64::~C_PlugBase64() {
2930

3031
bool C_PlugBase64::Decode(std::string const& strInput, std::string& strOut) {
3132
CryptoPP::Base64Decoder decoder;
32-
size_t puted = decoder.PutMessageEnd((const byte*)strInput.c_str(), strInput.size(), -1, false); //如果base64中有\n请使用true
33+
decoder.PutMessageEnd((const uint8_t*)strInput.c_str(), strInput.size(), -1, false); //如果base64中有\n请使用true
3334
if (!decoder.AnyRetrievable()) {
3435
return false;
3536
}
3637
auto neededLength = decoder.MaxRetrievable();
3738
strOut.resize(neededLength);
38-
decoder.Get((byte*)strOut.data(), neededLength);
39+
decoder.Get((uint8_t*)strOut.data(), neededLength);
3940
return true;
4041
}
4142

4243
bool C_PlugBase64::Encode(std::string const& strInput, std::string& strOut) {
4344
CryptoPP::Base64Encoder encoder;
44-
size_t puted = encoder.PutMessageEnd((const byte*)strInput.c_str(), strInput.size(), -1, false); //如果base64中有\n请使用true
45+
encoder.PutMessageEnd((const uint8_t*)strInput.c_str(), strInput.size(), -1, false); //如果base64中有\n请使用true
4546
if (!encoder.AnyRetrievable()) {
4647
return false;
4748
}
4849
auto neededLength = encoder.MaxRetrievable();
4950
strOut.resize(neededLength);
50-
encoder.Get((byte*)strOut.data(), neededLength);
51+
encoder.Get((uint8_t*)strOut.data(), neededLength);
5152
return true;
5253
}
5354

bsn_cpp/plug_net/src/tcp_server.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include <iostream>
1515

16-
using namespace boost::asio::ip::tcp;
16+
using namespace boost::asio::ip;
1717

1818
D_BsnNamespace1(plug_net)
1919
//////////////////////////////////////////////////////////////////////
@@ -32,8 +32,8 @@ C_TCPServer::~C_TCPServer() {
3232

3333
C_TCPServer::T_SPC_TCPServer C_TCPServer::GetSPC_TCPServer() {
3434
D_OutInfo();
35-
auto spI_TCPSC_TCPServer = GetSPI_TCPSC_TCPServer();
36-
auto spC_TCPServer = std::dynamic_pointer_cast<C_TCPServer>(spI_TCPSC_TCPServer);
35+
auto spI_TCPServer = GetSPI_TCPServer();
36+
auto spC_TCPServer = std::dynamic_pointer_cast<C_TCPServer>(spI_TCPServer);
3737
return spC_TCPServer;
3838
}
3939

@@ -90,7 +90,7 @@ bool C_TCPServer::StopListen() {
9090

9191
bool C_TCPServer::StopAllClient() {
9292
for (auto& session : m_ClientSessions) {
93-
session->StopSession();
93+
session->Stop();
9494
}
9595
m_ClientSessions.clear();
9696
return true;
@@ -131,10 +131,10 @@ void C_TCPServer::ListenCoro(boost::asio::yield_context yield) {
131131
boost::system::error_code ec;
132132

133133
{
134-
resolver Resover(m_IOService);
135-
resolver::query Query(
136-
spI_Address->GetAddr()
137-
, boost::lexical_cast<std::string>(spI_Address->GetPort())
134+
tcp::resolver Resover(m_IOService);
135+
tcp::resolver::query Query(
136+
Address->GetAddr()
137+
, boost::lexical_cast<std::string>(Address->GetPort())
138138
);
139139
auto EndPointItor = Resover.async_resolve(Query, yield[ec]);
140140
if (ec) {
@@ -145,7 +145,7 @@ void C_TCPServer::ListenCoro(boost::asio::yield_context yield) {
145145

146146
auto EndPoint = EndPointItor->endpoint();
147147
m_Acceptor.open(EndPoint.protocol());
148-
m_Acceptor.set_option(acceptor::reuse_address(true));
148+
m_Acceptor.set_option(tcp::acceptor::reuse_address(true));
149149
m_Acceptor.bind(EndPoint);
150150
m_Acceptor.listen();
151151
}
@@ -173,9 +173,9 @@ C_TCPServer* CreateC_TCPServer(C_PlugNet::T_SPC_PlugNet spC_PlugNet) {
173173
return pC_TCPServer;
174174
}
175175

176-
void ReleaseC_TCPServer(I_TCPSC_TCPServer* pI_TCPSC_TCPServer) {
176+
void ReleaseC_TCPServer(I_TCPServer* pI_TCPServer) {
177177
D_OutInfo();
178-
C_TCPServer* pC_TCPServer = static_cast<C_TCPServer*>(pI_TCPSC_TCPServer);
178+
C_TCPServer* pC_TCPServer = static_cast<C_TCPServer*>(pI_TCPServer);
179179
Delete(pC_TCPServer);
180180
}
181181

@@ -186,11 +186,11 @@ C_TCPServer::T_SPC_TCPServer C_TCPServer::NewC_TCPServer(C_PlugNet::T_SPC_PlugNe
186186
return spC_TCPServer;
187187
}
188188

189-
C_TCPServer::T_SPI_TCPSC_TCPServer C_TCPServer::NewI_TCPSC_TCPServer(C_PlugNet::T_SPC_PlugNet spC_PlugNet) {
189+
C_TCPServer::T_SPI_TCPServer C_TCPServer::NewI_TCPServer(C_PlugNet::T_SPC_PlugNet spC_PlugNet) {
190190
D_OutInfo();
191191
auto spC_TCPServer = C_TCPServer::NewC_TCPServer(spC_PlugNet);
192-
auto spI_TCPSC_TCPServer = spC_TCPServer->GetSPI_TCPSC_TCPServer();
193-
return spI_TCPSC_TCPServer;
192+
auto spI_TCPServer = spC_TCPServer->GetSPI_TCPServer();
193+
return spI_TCPServer;
194194
}
195195
//////////////////////////////////////////////////////////////////////
196196
D_BsnNamespace1End

bsn_cpp/plug_net/src/tcp_server.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class C_TCPServer : public I_TCPServer {
3939

4040
T_SPC_TCPServer GetSPC_TCPServer();
4141

42-
bool StartListen();
4342
void ListenCoro(boost::asio::yield_context yield);
4443

4544
bool StartSession(T_SPC_TCPServerClientSession session);

bsn_cpp/plug_net/src/tcp_server_client_session.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void C_TCPServerClientSession::RunCoro(boost::asio::yield_context yield) {
6363
if (ec) {
6464
D_OutInfo1(boost::system::system_error(ec).what());
6565
if (ec != boost::asio::error::operation_aborted) {
66-
m_spC_TCPServer->Stop(GetSPC_TCPServerClientSession());
66+
m_spC_TCPServer->StopSession(GetSPC_TCPServerClientSession());
6767
}
6868
break;
6969
}

0 commit comments

Comments
 (0)