Fixed issue with clients not properly ending their connection after being destroyed. Removed git tracking of compiled binaries/library.

This commit is contained in:
rna88 2018-03-12 13:45:41 -07:00
parent 73c54c580d
commit fe00af35d2
10 changed files with 21 additions and 5 deletions

4
.gitignore vendored
View File

@ -1 +1,5 @@
*.o
*.a
examples/bin/*
!examples/bin/.gitkeep
!lib/.gitkeep

View File

@ -9,7 +9,7 @@ When cloning use the `--recurse-submodules` flag to retrieve the enet and zlib l
`git clone --recurse-submodules https://github.com/rna88/irrnet.git`
Then run `make` in the `source/` directory to build the library.
Then run `make` in the `source/` directory to build the library, which will be placed in `lib/`.
## Building examples
@ -22,9 +22,9 @@ or to build them with optimizations:
`./linux_buildAllExamples.sh release`
The compiled binaries will be found in `examples/bin/`
The compiled binaries will be found in `examples/bin/`.
## License
Refer to `source/ReadMe.txt`
Refer to `source/ReadMe.txt`.

View File

@ -103,6 +103,7 @@ public:
message += " has just left the building.";
packet << message;
netManager->sendOutPacket(packet);
std::cout << "Client number " << playerId << " disconnected" << std::endl;
}
// Handle the packets, as usual.
@ -213,11 +214,14 @@ int main()
netManager->sendOutPacket(packet);
}
// Here is the update loop, we will exit if there is a connection problem.
while(netManager->getConnectionStatus() != net::EICS_FAILED)
// Here is the update loop, we will exit if there is a connection problem
// or after running for 10 seconds.
int i = 0;
while(netManager->getConnectionStatus() != net::EICS_FAILED && i < 10)
{
// Here we update.
netManager->update(1000);
++i;
}
// Clean up.

0
examples/bin/.gitkeep Normal file
View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
lib/.gitkeep Normal file
View File

Binary file not shown.

View File

@ -29,6 +29,14 @@ namespace irr
CNetManager::~CNetManager(void)
{
if(mode == ENM_CLIENT)
{
ENetEvent event;
enet_peer_disconnect(peer, 0);
enet_host_service(host, &event, 0);
}
if(host)
enet_host_destroy(host);