summaryrefslogtreecommitdiffstats
path: root/source/cHeartBeat.cpp
diff options
context:
space:
mode:
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);
}
}
+
+
+
+