irrnet/examples
rna88 85822e682e Fix getPeerCount() to return correct number of peers
Calling getPeerCount() used to return the maximum number
of peers on the host, no matter how many peers were actually
connected. Changing this function to count the elements within
the "players" vector returns the correct peer count.

However calling getPeerCount() within the "onDisconnect" callback
results in an extra peer being present due to the "players"
vector only being updated *after* the callback invocation. Hence
the "onDisconnect" callback is now invoked after the disconnecting
peer is removed from the vector.

* Count peers by looping through the "players" vector.
* Move invocation of "onDisconnect" callback to after peer is deleted.
* Add getPeerCount() calls to example 3 to illustrate use.
2018-03-16 04:07:50 -07:00
..
01.Tutorial Rename examples numerically 2018-03-16 03:36:19 -07:00
02.PacketIdentification Rename examples numerically 2018-03-16 03:36:19 -07:00
03.ClientManagement Fix getPeerCount() to return correct number of peers 2018-03-16 04:07:50 -07:00
bin Fix issue with clients not properly disconnecting 2018-03-16 03:40:45 -07:00
linux_compile_all.sh Rename examples numerically 2018-03-16 03:36:19 -07:00