Skip to content

Commit 497299a

Browse files
committedMay 18, 2015
Lower log level for unexpected behaviour
Its a possible mistake to log in to a server with twice the same name. Before, it triggered a server wide error message, now it logs to actionstream.
1 parent d2ca662 commit 497299a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

Diff for: ‎src/network/serverpackethandler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
613613
playersao = StageTwoClientInit(pkt->getPeerId());
614614

615615
if (playersao == NULL) {
616-
errorstream
616+
actionstream
617617
<< "TOSERVER_INIT2 stage 2 client init failed for peer "
618618
<< pkt->getPeerId() << std::endl;
619619
return;
@@ -710,7 +710,7 @@ void Server::handleCommand_ClientReady(NetworkPacket* pkt)
710710
PlayerSAO* playersao = StageTwoClientInit(peer_id);
711711

712712
if (playersao == NULL) {
713-
errorstream
713+
actionstream
714714
<< "TOSERVER_CLIENT_READY stage 2 client init failed for peer_id: "
715715
<< peer_id << std::endl;
716716
m_con.DisconnectPeer(peer_id);

Diff for: ‎src/server.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1073,16 +1073,16 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id)
10731073
static_cast<RemotePlayer*>(m_env->getPlayer(playername.c_str()));
10741074

10751075
// If failed, cancel
1076-
if((playersao == NULL) || (player == NULL)) {
1077-
if(player && player->peer_id != 0) {
1078-
errorstream<<"Server: "<<playername<<": Failed to emerge player"
1079-
<<" (player allocated to an another client)"<<std::endl;
1076+
if ((playersao == NULL) || (player == NULL)) {
1077+
if (player && player->peer_id != 0) {
1078+
actionstream << "Server: Failed to emerge player \"" << playername
1079+
<< "\" (player allocated to an another client)" << std::endl;
10801080
DenyAccess_Legacy(peer_id, L"Another client is connected with this "
10811081
L"name. If your client closed unexpectedly, try again in "
10821082
L"a minute.");
10831083
} else {
1084-
errorstream<<"Server: "<<playername<<": Failed to emerge player"
1085-
<<std::endl;
1084+
errorstream << "Server: " << playername << ": Failed to emerge player"
1085+
<< std::endl;
10861086
DenyAccess_Legacy(peer_id, L"Could not allocate player.");
10871087
}
10881088
return NULL;

2 commit comments

Comments
 (2)

nerzhul commented on May 19, 2015

@nerzhul
Contributor

Are you sure ? Actionstream is output to stdout.

est31 commented on May 19, 2015

@est31
ContributorAuthor

I think clients should never be abled to trigger a log message in errorstream.

Please sign in to comment.