summaryrefslogtreecommitdiffstats
path: root/source/cHeartBeat.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 14:43:47 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-01 14:43:47 +0100
commit2568bad3cc1ae70350f5ad31e97b4c13194e437e (patch)
tree31d0713dfe1b4e42c1f17ddae8ea0114c420fc61 /source/cHeartBeat.cpp
parentRemoved a few duplicate includes (diff)
downloadcuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.gz
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.bz2
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.lz
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.xz
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.tar.zst
cuberite-2568bad3cc1ae70350f5ad31e97b4c13194e437e.zip
Diffstat (limited to '')
-rw-r--r--source/cHeartBeat.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/source/cHeartBeat.cpp b/source/cHeartBeat.cpp
index c1aa327c5..fd1cdc805 100644
--- a/source/cHeartBeat.cpp
+++ b/source/cHeartBeat.cpp
@@ -19,10 +19,18 @@ cHeartBeat::cHeartBeat()
Authenticate();
}
+
+
+
+
cHeartBeat::~cHeartBeat()
{
}
+
+
+
+
void cHeartBeat::ReceivedData( char a_Data[256], int a_Size )
{
if( a_Size < 0 ) // Disconnected
@@ -97,28 +105,40 @@ void cHeartBeat::ReceivedData( char a_Data[256], int a_Size )
} while( bLoop );
}
+
+
+
+
void cHeartBeat::SendUpdate()
{
CloseSocket();
if( Connect( "mc-server.org", 80 ) )
{
int Port = cRoot::Get()->GetServer()->GetPort();
- char c_Port[16];
- sprintf_s( c_Port, 16, "%i", Port );
-
- std::string sPort = std::string( c_Port );
- std::string sChecksum = md5( m_ServerID + sPort );
- SendMessage( (std::string("GET http://master.mc-server.org/?update=") + m_ServerID + std::string("&checksum=") + sChecksum + std::string("&port=") + sPort + "\n").c_str() );
+ AString Msg;
+ AString sPort;
+ Printf(sPort, "%i", Port);
+ AString sChecksum = md5( m_ServerID + sPort );
+ Printf(Msg, "GET http://master.mc-server.org/?update=%s&checksum=%s&port=%d\n", m_ServerID, sChecksum , Port);
+ SendMessage(Msg.c_str());
}
}
+
+
+
+
void cHeartBeat::Authenticate()
{
CloseSocket();
- if( Connect( "mc-server.org", 80 ) )
+ if (Connect( "mc-server.org", 80))
{
m_State = 1;
int RetVal = SendMessage( "GET http://master.mc-server.org/\r\n\r\n");
- LOGINFO("Returned %i", RetVal );
+ LOGINFO("Returned %i", RetVal);
}
}
+
+
+
+