1
0
Fork 0
Commit Graph

296 Commits

Author SHA1 Message Date
Mattes D 876496c953 Removed "." and ".." from cFile:GetFolderContents(). (#3301) 2016-08-07 12:50:19 +02:00
Mattes D 8eaa8613da CMake: Remove needless minimum version specifications. 2016-07-18 22:11:42 +02: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
Mattes D 36eefbf0f2 SelfTests: Removed the unneeded cSelfTests class. 2016-06-18 13:12:10 +02:00
Mattes D 3184433756 Moved NetworkInterfaceEnum test to a separate test project. 2016-06-18 13:12:06 +02:00
LogicParrot ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Mattes D 80e1eb37dd Renamed leftover strings to Cuberite / Server, as needed.
Also upgraded the user setting file for MSVC to 2013.
2016-01-01 21:05:09 +01:00
tycho d01562cb7d Use atomic bool for isthread terminate 2015-12-19 19:29:06 +01:00
Alexander Harkness 8b851d5048 Added HTTPS links wherever they are supported. 2015-12-19 14:30:32 +00:00
Lukas Pioch d620dcdd08 Moved variables into scope, removed unused variables and fixed variables 2015-12-17 10:48:36 +01:00
Mattes D 03a972ec55 Use C++11 auto instead of per-platform types.
Closes #2686.
2015-12-03 14:39:36 +01:00
Thomas Boerger ffed489156 Include execinfo.h only on __GLIBC__ 2015-11-19 22:46:47 +01:00
Thomas Boerger a16a9eab4f Define stacktrace functions only if __GLIBC__ is defined 2015-11-19 22:46:47 +01:00
Thomas Boerger 8f3f91d3db Check for __GLIBC__ to detect correct strerror_r version 2015-11-19 22:23:47 +01:00
bibo38 ec5c38761f Changed for-loop iterator in File.cpp to a reference type to reduce object copying and fix the clang build.
Fixes #2580
2015-10-30 20:16:45 +01:00
Tiger Wang 4ddff15710 Merge pull request #2498 from cuberite/UnicodeOnWindows
Enabled Unicode support for Windows
2015-09-28 09:14:09 +01:00
Tiger Wang 803c0c6965 Added the _UNICODE flag on Windows 2015-09-26 22:19:29 +01:00
Mattes D ad57ce5f99 Extended and fixed the cFile API. 2015-09-26 22:54:18 +02:00
Mattes D 9871c0b073 Added CircleCI for stylechecking.
This will allow us to remove the stylecheck from Travis builds, making them a bit faster, and having fast style checks
2015-09-17 11:20:10 +02:00
Tiger Wang dfc0f2ae00 Small fix for cEvent
Don't bother using atomics since a synchronisation primitive is already
being used.
2015-08-26 23:02:45 +01: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
Julian Laubstein dd5201c29e Some warning fixes 2015-08-18 08:49:00 +02:00
Mattes D 6e4122e551 Unified the doxy-comment format. 2015-07-31 16:49:10 +02:00
Mattes D 7379848ae5 Moved AString reading hack to cFile. 2015-07-31 08:48:22 +02:00
Samuel Barney 804805d35a Silenced and fixed many warning messages across multiple files. 2015-07-29 09:49:30 -06: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 a55eaba7fa Network: Fixed ServerHandle's address formatting. 2015-07-07 18:10:47 +02:00
worktycho 106e06617a Merge pull request #2224 from cuberite/ChunkQueueCollapsing
Chunk queue collapsing: MK II
2015-07-04 14:43:00 +01:00
Tiger Wang 33fc1474d9 Fixed minor errors in Tycho's code
Everything should work now :)
2015-06-22 21:27:13 +01:00
Mattes D d390214929 SelfTests are registered and executed after logging framework init.
Fixes #2228.
2015-06-11 22:20:04 +02:00
Cengiz Can c967698b2d Skip unknown cflag for Apple clang & remove cSemaphore 2015-06-04 11:48:56 +03:00
linnemannr ee34e7131a Fix FreeBSD/clang errors caused by -Werror
With FreeBSD/clang, -Werror combined with the configured warning flags yields
some fatal errors, specifically related to signed conversion, 64 to 32 bit
conversion, and tautological compares.

CONTRIBUTORS

	Add myself to the contributor list

src/Generating/FinishGen.cpp

	In cFinishGenPassiveMobs::GetRandomMob(), change the type of RandMob
	from size_t to the difference_type of the ListOfSpawnables iterator
	MobIter. Using size_t triggers a 64 bit to 32 bit conversion if the
	difference_type of the iterator class is 64 bit

	Also explicitly cast the noise expression to unsigned long so we don't
	get a signed conversion warning from the modulo against
	ListOfSpawnables.size()

src/OSSupport/StackTrace.cpp

	FreeBSD 10 and above includes a non glibc implementation of benchmark()
	for which size_t, not int, is the return type. To account for this and
	prevent a signed conversion warning, abstract the type for numItems with
	a macro btsize

src/StringUtils.h

	In StringToInteger(), correct a tautological compare warning for
	unsigned types with the template. If T is unsigned, comparing
	std::numeric_limits<T>::min() to the unsigned result is always
	false. That control can enter this branch in an evaluated template with
	an unsigned type T may also permit a signed number to be parsed and
	erroneously stripped of its signedness at runtime. To guard against this
	and avoid the warning in the case that the number parsed from the string
	is non-positive, return false and don't try to parse if T is unsigned
	and control enters the non-positive branch
2015-05-30 02:23:57 -06:00
tycho e19693e529 Merge branch 'master' into PreventNewWarnings
Conflicts:
	src/Inventory.cpp
2015-05-28 11:05:41 +01:00
linnemannr 5049fd0fbf Support building on FreeBSD
SetFlags.cmake

	Add -lexecinfo to linker flags for FreeBSD to resolve backtrace()

lib/sqlite/CMakeLists.txt

	Define _XOPEN_SOURCE to 600 instead of __POSIX_VISIBLE to 200112 for
	POSIX 1-2001 support. For POSIX standards, the _XOPEN_SOURCE define
	controls the eventual value of __POSIX_VISIBLE. _XOPEN_SOURCE is defined
	to 500 in sqlite.c if not already defined, which sets up _POSIX_C_SOURCE
	and __POSIX_VISIBLE to the 199506 for POSIX.1c

lib/tolua++/CMakeLists.txt
src/CMakeLists.txt

	Add /usr/local/lib to the library search path for FreeBSD builds

src/OSSupport/Errors.cpp

	Correct the strerror_r() implementation determination to check whether
	_GNU_SOURCE is defined, not what it evaluates to
2015-05-24 20:07:31 -06:00
tycho dae9e5792a Made -Weverything an error. 2015-05-24 12:56:56 +01:00
tycho a5624debcb Fix tests 2015-05-23 13:21:02 +01:00
tycho 050a014106 Finish fixing windows 2015-05-19 14:02:02 +01:00
tycho 6cccd2aabb Properly fix cFile Warnings 2015-05-19 13:33:34 +01:00
tycho f2689c4887 Fixed a lot of warnings 2015-05-19 11:50:59 +01:00
Mattes D 846d16315a CheckBasicStyle: checks spaces around * and &. 2015-05-09 12:58:55 +02:00
Mattes D c13b1931ff More style checking.
Spaces around some operators are checked.
2015-05-09 12:58:54 +02:00
Mattes D 8d4a87d2c4 Fixed bindings for cFile:ReadWholeFile().
Fixes #1914
2015-04-30 11:44:42 +02:00
Mattes D 7ef9dea015 Network: fixed excessive debug logging. 2015-04-21 12:11:44 +02:00
Mattes D 79e8f8fb20 cFile:ChangeFileExt now accepts extensions with leading dot, too. 2015-04-11 17:42:32 +02:00
Mattes D c4842cb9aa Added more cFile API functions.
GetLastModificationTime, GetPathSeparator() and GetExecutableExt()
2015-04-11 10:06:08 +02:00
Mattes D 65a1158e40 Added proper implementation of cFile::ChangeFileExt(). 2015-04-10 21:40:45 +02:00
Mattes D 6952f2295a Added cFile:ChangeFileExt() function. 2015-04-06 22:00:54 +02:00
Mattes D c626848393 Unified cPacketizer across all protocols. 2015-03-22 19:46:08 +01:00
Mattes D 0aff42a4bc Network: Close the UDP endpoint in destructor. 2015-03-18 13:50:43 +01:00
Tiger Wang 4ffaace384 Use std::memcpy to fix alignment
As suggested by @madmaxoft
2015-03-10 22:25:53 +00:00
Tiger Wang 20da3d34a5 Potential Linux implementation 2015-03-08 16:54:44 +00:00
Mattes D 1551e29f00 Network: Replaced magic number with named constant. 2015-02-22 18:52:49 +01:00
Mattes D c758482ece cNetwork: Added EnumLocalIPAddresses() function. 2015-02-22 10:51:16 +01:00
Mattes D e30ee8063d UDPEndpointImpl: Fixed clang warnings. 2015-02-20 16:05:53 +01:00
Mattes D 9c5162041e cNetwork: Added UDP API. 2015-02-20 14:28:05 +01:00
Mattes D 70d54054e3 NetworkSingleton: LibEvent thread is joined properly on server exit. 2015-02-18 22:41:22 +01:00
Mattes D 612637ab2e Network: Fixed two-socket servers. 2015-02-18 09:35:14 +01:00
Mattes D d336a3ea9e Fixed TCP link shutdown.
The shutdown is postponed until there's no more outgoing data in the LibEvent buffers.
2015-02-14 13:55:54 +01:00
Mattes D 81d7329ad3 ServerHandle: Fixed socket reuse.
Fixes CID 104670, CID 104670 and CID 103724.
2015-02-08 14:41:24 +01:00
Mattes D 5ee5a691b7 Merge pull request #1729 from mc-server/ReuseFlag
Set reuse flag to sockets
2015-02-08 00:08:18 +01:00
Howaner be528a9f52 Use evutil_make_listen_socket_reuseable 2015-02-07 18:39:24 +01:00
Howaner d32831d7e8 Set reuse flag to sockets
Should fix #1726
2015-02-07 11:03:38 +01:00
Mattes D 014b96adb3 Exported cServerHandle and cNetwork:Listen to Lua.
Also added an example to the NetworkTest plugin.
2015-02-04 08:40:52 +01:00
Mattes D e098728fa8 cTCPLink: Fixed missing addresses on link connection. 2015-02-04 08:40:51 +01:00
Mattes D 79dee9bb70 Fixed listening ports not closed on cServerHandle::Close. 2015-01-27 14:53:39 +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 9a2200f8bb cTCPLinkImpl: Added the BEV_OPT_THREADSAFE flag. 2015-01-27 14:53:37 +01:00
Mattes D 2557f2867d ServerHandleImpl: Removed needless diagnostic output. 2015-01-27 14:53:36 +01:00
Mattes D 1b9c0f1030 Removed cFile::ReplaceFileNameInvalidChars().
Its only usage in cProtocol18 has been changed to a simple string replace - only the IPv6's colons were causing problems.
2015-01-27 14:53:34 +01:00
Mattes D f243aa387c Removed ListenThread and SocketThreads.
They have been replaced by the cNetwork API.
Socket.cpp is still used by RCONClient.
2015-01-27 14:53:32 +01:00
Mattes D 1f2f8b553b cNetwork: Fixed IP address reading for incoming connections. 2015-01-27 14:53:30 +01:00
Mattes D f1f12495b2 cFile: Added ReplaceFileNameInvalidChars(). 2015-01-27 14:53:29 +01:00
Mattes D 80a386cbc4 Fixed missing LibEvent reference in OSSupport. 2015-01-27 14:53:26 +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 9014bdfa32 cNetwork: Renamed callback to OnConnected() 2015-01-22 22:49:37 +01:00
Mattes D dbf7f13bd4 cNetwork: Added link creation callback.
This allows the callback classes to store the link inside them and use it internally later on, mainly for sending data.
2015-01-22 20:13:06 +01:00
Mattes D 5b4c5cf2be cNetwork: Changed listening API.
The link-callbacks for each new accepted link are now received from the OnIncomingConnection listen-callback.
2015-01-22 20:13:05 +01:00
Mattes D 64855ed340 cNetwork: Added error message to error callbacks. 2015-01-22 20:13:04 +01:00
Mattes D 00253403b3 cTCPLinkImpl: Fixed type conversion warning. 2015-01-22 20:13:03 +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 1e5aedacea cNetwork: Fixed WinXP dualstack listening. 2015-01-22 20:13:01 +01:00
Mattes D d3076a3e16 cNetwork: Split cNetworkSingleton to a separate file. 2015-01-22 20:13:00 +01:00
Mattes D ae29a82eba cNetwork: Fixed WSAStartup()-not-called error in Listen(). 2015-01-22 20:12:59 +01:00
Mattes D 60807adfb5 cNetwork: Handle WSA initialization failures. 2015-01-22 20:12:58 +01:00
Mattes D 7cddb62374 cNetwork: Added an OnError callback for listening servers.
The callback receives the error details.
2015-01-22 20:12:57 +01:00
Mattes D 646e636933 cNetwork: Rewritten server listen into a factory method. 2015-01-22 20:12:56 +01:00
Mattes D 4647e6ad71 cNetwork: Removed unneeded dependency. 2015-01-22 20:12:55 +01:00
Mattes D 728a624e48 cNetwork: Refactored cTCPLinkImpl::Connect into a factory. 2015-01-22 20:12:55 +01:00
Mattes D 6f29cfe084 cNetwork: Cosmetics. 2015-01-22 20:12:54 +01:00
Mattes D b59206207c cNetwork: Fixed compilation. 2015-01-22 20:12:52 +01:00
worktycho 19121d2962 Wrap debug variable in ifdef
avoidss unused variable error in clang
2015-01-22 20:12:51 +01:00
Mattes D 235b8f1f6b cNetwork: Added error logging to server socket creation.
This is mainly for WinXP and RasPi testing.
2015-01-22 20:12:50 +01:00
Mattes D ddb1818dd5 cNetwork: Added multithreading protection. 2015-01-22 20:12:50 +01:00
Mattes D d8ac99a037 cNetwork: Implemented connection shutdown and close. 2015-01-22 20:12:49 +01:00
Mattes D 9ffca12709 cNetwork: Fixed Linux compilation. 2015-01-22 20:12:48 +01:00
Mattes D a2aa37bdc5 cNetwork: Implemented link address getting. 2015-01-22 20:12:47 +01:00
Mattes D 28e97d5468 cNetwork: Implemented basic server functionality. 2015-01-22 20:12:46 +01:00
Mattes D 251c96952b cNetwork: Implemented IP-to-hostname lookup. 2015-01-22 20:12:45 +01:00