Skip to content

Commit 45b68ab

Browse files
committedJul 19, 2018
update demo
1 parent 9a38bd2 commit 45b68ab

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed
 

‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@
1111
*.lai
1212
*.la
1313
*.a
14+
15+
build/
16+
.vscode/

‎test/Server.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ void Server::on_tcp_connect(uvpp::error error)
4848
os << "tcp://" << peer_ip << ":" << port;
4949
string peer_ = os.str();
5050

51+
tcp_conn.set_peer_name(peer_);
52+
5153
auto res = m_connections.emplace(piecewise_construct,
5254
forward_as_tuple(move(peer_)),
5355
forward_as_tuple(move(tcp_conn_ptr)));

‎test/TcpConnection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void TcpConnection::input(const char *data, size_t len)
2020
buf.resize(len);
2121
memcpy(&buf[0], data, len);
2222
buf.push_back('\0');
23-
cout << buf << " len:" << len << endl;
23+
cout << m_peerName << ":" << buf << " len:" << len << endl;
2424
}
2525

2626
void TcpConnection::send_msg(const std::string &&msg)

0 commit comments

Comments
 (0)