Skip to content

Commit d38f6eb

Browse files
sapiersapier
sapier
authored and
sapier
committedJul 16, 2014
Fix error handling on inconsistent client ready message
Fix android makefile to provide a correct dummy githash if detection fails
1 parent 7d72ac6 commit d38f6eb

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
 

‎build/android/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,11 @@ $(ROOT)/jni/src/android_version.h :
691691
echo "#define VERSION_PATCH_ORIG $$(cat ${ROOT}/../../CMakeLists.txt | \
692692
grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | awk '{print $$2;}')" \
693693
>> ${ROOT}/jni/src/android_version.h; \
694-
echo "#define CMAKE_VERSION_GITHASH \"$$(git rev-parse --short=8 HEAD)\"" \
694+
export GITHASH=$$(git rev-parse --short=8 HEAD); \
695+
if [ "x$$GITHASH" = "x" ] ; then \
696+
export GITHASH=gUnknown; \
697+
fi; \
698+
echo "#define CMAKE_VERSION_GITHASH \"$$GITHASH\"" \
695699
>> ${ROOT}/jni/src/android_version.h; \
696700
echo "#define CMAKE_VERSION_STRING STR(VERSION_MAJOR)\".\"STR(VERSION_MINOR)\
697701
\".\"STR(VERSION_PATCH)" \

‎src/server.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -1732,14 +1732,20 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
17321732

17331733
if (playersao == NULL) {
17341734
errorstream
1735-
<< "TOSERVER_CLIENT_READY stage 2 client init failed for peer "
1735+
<< "TOSERVER_CLIENT_READY stage 2 client init failed for peer_id: "
17361736
<< peer_id << std::endl;
1737+
m_con.DisconnectPeer(peer_id);
17371738
return;
17381739
}
17391740

17401741

1741-
if(datasize < 2+8)
1742+
if(datasize < 2+8) {
1743+
errorstream
1744+
<< "TOSERVER_CLIENT_READY client sent inconsistent data, disconnecting peer_id: "
1745+
<< peer_id << std::endl;
1746+
m_con.DisconnectPeer(peer_id);
17421747
return;
1748+
}
17431749

17441750
m_clients.setClientVersion(
17451751
peer_id,

0 commit comments

Comments
 (0)
Please sign in to comment.