summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-04 21:05:35 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-09-04 21:05:35 +0200
commite3d5da24091bad6043d7eef00f8f297bf1203ab5 (patch)
tree409ee30de2e9df0c46f0d4043149d01616a520e1
parentFixed preprocessor definitions in Linux (diff)
downloadcuberite-e3d5da24091bad6043d7eef00f8f297bf1203ab5.tar
cuberite-e3d5da24091bad6043d7eef00f8f297bf1203ab5.tar.gz
cuberite-e3d5da24091bad6043d7eef00f8f297bf1203ab5.tar.bz2
cuberite-e3d5da24091bad6043d7eef00f8f297bf1203ab5.tar.lz
cuberite-e3d5da24091bad6043d7eef00f8f297bf1203ab5.tar.xz
cuberite-e3d5da24091bad6043d7eef00f8f297bf1203ab5.tar.zst
cuberite-e3d5da24091bad6043d7eef00f8f297bf1203ab5.zip
-rw-r--r--source/Protocol125.cpp2
-rw-r--r--source/cClientHandle.cpp7
-rw-r--r--source/cClientHandle.h4
-rw-r--r--source/cPlayer.cpp2
-rw-r--r--source/cServer.cpp2
5 files changed, 10 insertions, 7 deletions
diff --git a/source/Protocol125.cpp b/source/Protocol125.cpp
index 41a64f24b..4f162dab6 100644
--- a/source/Protocol125.cpp
+++ b/source/Protocol125.cpp
@@ -1028,7 +1028,7 @@ int cProtocol125::ParseLogin(void)
LOGWARNING("Login Username (\"%s\") does not match Handshake username (\"%s\") for client @ \"%s\", kicking",
Username.c_str(),
m_Username.c_str(),
- m_Client->GetSocket().GetIPString().c_str()
+ m_Client->GetIPString().c_str()
);
m_Client->Kick("Hacked client"); // Don't tell them why we don't want them
return PARSE_OK;
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index f4f5125c2..06325785e 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -1546,8 +1546,11 @@ void cClientHandle::DataReceived(const char * a_Data, int a_Size)
void cClientHandle::GetOutgoingData(AString & a_Data)
{
// Data can be sent to client
- m_OutgoingData.ReadAll(a_Data);
- m_OutgoingData.CommitRead();
+ {
+ cCSLock Lock(m_CSOutgoingData);
+ m_OutgoingData.ReadAll(a_Data);
+ m_OutgoingData.CommitRead();
+ }
// Disconnect player after all packets have been sent
if (m_bKicking && a_Data.empty())
diff --git a/source/cClientHandle.h b/source/cClientHandle.h
index ba9cde7f5..ab4e3e64c 100644
--- a/source/cClientHandle.h
+++ b/source/cClientHandle.h
@@ -60,8 +60,8 @@ public:
cClientHandle(const cSocket & a_Socket, int a_ViewDistance);
~cClientHandle();
- const cSocket & GetSocket(void) const {return m_Socket; }
- cSocket & GetSocket(void) {return m_Socket; }
+ cSocket & GetSocket (void) { return m_Socket; }
+ const AString & GetIPString(void) const { return m_Socket.GetIPString(); }
cPlayer* GetPlayer() { return m_Player; } // tolua_export
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp
index 4605049b3..4095c633a 100644
--- a/source/cPlayer.cpp
+++ b/source/cPlayer.cpp
@@ -57,7 +57,7 @@ cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName)
, m_FoodTickTimer(0)
{
LOGD("Created a player object for \"%s\" @ \"%s\" at %p, ID %d",
- a_PlayerName.c_str(), a_Client->GetSocket().GetIPString().c_str(),
+ a_PlayerName.c_str(), a_Client->GetIPString().c_str(),
this, GetUniqueID()
);
m_EntityType = eEntityType_Player;
diff --git a/source/cServer.cpp b/source/cServer.cpp
index b294842b7..988594943 100644
--- a/source/cServer.cpp
+++ b/source/cServer.cpp
@@ -510,7 +510,7 @@ void cServer::ServerCommand(const AString & a_Cmd)
{
virtual bool Item(cPlayer * a_Player) override
{
- LOG("\t%s @ %s", a_Player->GetName().c_str(), a_Player->GetClientHandle()->GetSocket().GetIPString().c_str());
+ LOG("\t%s @ %s", a_Player->GetName().c_str(), a_Player->GetClientHandle()->GetIPString().c_str());
return false;
}
} Logger;