1
0
Fork 0
Commit Graph

20 Commits

Author SHA1 Message Date
peterbell10 6036971c77
libevent: Enable IOCP backend on windows (#4745) 2020-06-08 21:03:29 +01:00
peterbell10 13144a08e4
Enable some more clang-tidy linter checks (#4738)
* Avoid inefficient AString -> c_str() -> AString round trip

* Avoid redundant string init expressions

* Avoid unnecessary return, continue, etc.

* Add .clang-format to help with clang-tidy fix-its

* Avoid unnecessary passing by value

* Avoid unnecessary local copying

* Avoid copying in range-for loops

* Avoid over-complicated boolean expressions

* Some violations missed by my local clang-tidy

* Allow unnecessary continue statements

* Add brackets

* Another expression missed locally

* Move BindingsProcessor call into clang-tidy.sh and add space

* Fix pushd not found error

* Different grouping of CheckBlockInteractionRate
2020-05-14 22:15:35 +00:00
peterbell10 154df6b09d
Cleanup unneeded globals (#4736) 2020-05-10 16:16:38 +00:00
peterbell10 ee84197014
Force all headers other than "Globals.h" to be included with relative paths (#4269)
Closes #4236

CMake now creates a header file in the build directory under the path "include/Globals.h" which just includes "src/Globals.h" with an absolute path. Then instead of adding "src/" to the include directories, it adds "include/".

#include "Globals.h" still works by including the build generated file and any other src-relative path will not work.
2018-08-29 01:51:25 +01:00
peterbell10 a4dbb5c582
Prefer static_cast to reinterpret_cast (#4223)
* Change reinterpret_cast -> static_cast wherever possible
* Remove more unnecessary `const_cast`s.

reinterpret_casts should be avoided for the same reason as c-style casts - they don't do any type-checking. reinterpret_cast was mainly being used for down-casting in inheritance hierarchies but static_cast works just as well while also making sure that there is actually an inheritance relationship there.
2018-05-02 08:50:36 +01:00
peterbell10 1ea36298d2
Fix cUrlClient leak (#4125)
Fixes #4040
* The TCP connection is now shutdown after OnBodyFinished
* Any open connections are closed when cNetworkSingleton::Terminate() is called.
* Removed ownership cycles in cUrlClientRequest
* Added a check to the test to ensure there are no leaks.
2018-02-20 17:08:46 +00:00
Mattes D ea6660721b NetworkSingleton: Fixed a throw warning in VS2017. (#3792)
Also fixed the misleading name.
2017-06-22 21:10:41 +02:00
Mattes D bb020bbe78 NetworkSingleton: Fixed an object leak upon termination. 2017-06-17 07:14:20 +02:00
peterbell10 035ecdc9e2 Replace evdns with getaddrinfo and getnameinfo (#3766) 2017-06-15 11:03:49 +02:00
Tiger Wang 8c6d0b51c7 Use CMake's Android generators to crosscompile 2016-12-12 14:32:32 +00:00
Mattes D 1462e4f70e Self tests (#3242)
* SelfTests: Added a cEvent stress-test.

* cNetwork: Fixed startup event hang.

The original code used to hang with a ~ 1:50000 chance, because on Linux the cEvent was destroyed before its "Set()" returned.
2016-06-26 14:51:12 +01:00
Mattes D 8610083a8e cNetwork: Fixed possible hang when terminating immediately after init. 2016-06-18 13:12:12 +02:00
Tiger Wang 4315a11393 Fixed and improved restarting
Restarts are now an actual, close-as-possible to application
exit+reopen.
2015-08-20 16:15:23 +01:00
Mattes D c74d856b57 Fixed cNetworkSingleton's HasTerminated flag.
Should fix random failures in Google-test.
2015-07-23 16:15:21 +02:00
Mattes D 70d54054e3 NetworkSingleton: LibEvent thread is joined properly on server exit. 2015-02-18 22:41:22 +01:00
Mattes D 053362e604 Added network termination called at app exit.
This fixes a crash in MSVC runtime caused by joining a thread in a global var's destructor.
2015-01-27 14:53:37 +01:00
Mattes D 10cfa61fbc cNetwork: Added self pointers to keep objects alive for callbacks.
Ref.: http://forum.mc-server.org/showthread.php?tid=1700&pid=17947#pid17947
2015-01-23 23:01:18 +01:00
Mattes D d4682463a1 cNetwork: Fixed race conditions with lookups; proper shutdown. 2015-01-22 20:13:02 +01:00
Mattes D c0cb787c10 cNetwork: Split the main cpp file into several files. 2015-01-22 20:13:02 +01:00
Mattes D d3076a3e16 cNetwork: Split cNetworkSingleton to a separate file. 2015-01-22 20:13:00 +01:00