1
0
Fork 0
Commit Graph

296 Commits

Author SHA1 Message Date
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
Mattes D fde44cba08 cNetwork: Implemented HostnameToIP lookups. 2015-01-22 20:12:45 +01:00
Tycho a9b8a530b1 Extracted Google connection test 2015-01-22 20:12:42 +01:00
Mattes D b8b3409b74 cNetwork: Linux compilation fix. 2015-01-22 20:12:41 +01:00
Mattes D 6f5e267d58 Implemented LibEvent-based client connections. 2015-01-22 20:12:40 +01:00
Mattes D 45b1d5ff78 Fixed various warnings. 2015-01-18 18:01:24 +01:00
Kirill Kirilenko 3dc994f9dc Fixed CppCheck: (performance) Possible inefficient checking for emptiness. 2015-01-17 15:20:03 +03:00
Mattes D 081e7ddd02 cIsThread: Fixed a race condition on thread start. 2014-12-25 00:34:54 +01:00
Mattes D 781b3303a5 Merge pull request #1657 from mc-server/PrepareChunk
Prepare chunk
2014-12-11 17:06:18 +01:00
Mattes D 33c6ff872e Cosmetic touchups.
Removed trailing whitespace, added cast to remove warning, added file seeking in case of corrupt files.
2014-12-11 14:34:09 +01:00
Mattes D 2ab8d2bd98 Added a RemoveIf() function to cQueue 2014-12-09 10:43:40 +01:00
Mattes D c65bb6341d Fixed integer overflow problems.
The event would overflow when requesting a 60 minute timeout.
2014-12-07 21:37:47 +01:00
Mattes D 8ad1afcc1b Merge remote-tracking branch 'origin/master' into c++11Events 2014-12-07 18:15:23 +01:00
Mattes D 3c3cb198f3 Fixed c++11 branch issues. 2014-12-07 15:46:27 +01:00
Tiger Wang 3acdf25b05 Merge remote-tracking branch 'origin/master' into c++11
Conflicts:
	src/OSSupport/Thread.cpp
2014-12-06 17:41:48 +00:00
Mattes D 3f23813412 Merge pull request #1647 from mc-server/SocketThreadsFix
Fixes socket leak in HTTP server.
2014-12-06 16:08:08 +01:00
Mattes D e2a04f580a BasicStyle: Added missing braces to control statements. 2014-12-05 16:59:11 +01:00
Mattes D 44644ae025 Fixed reported parentheses around comparisons. 2014-12-05 12:58:47 +01:00
Mattes D 64f8428d03 Fixed trailing whitespace. 2014-12-04 22:07:04 +01:00
Mattes D c014f5624c Merged branch 'origin/master' into c++11. 2014-12-04 22:04:16 +01:00
Mattes D 010546051e Fixes socket leak in HTTP server.
Fixes #1643.
2014-12-03 16:14:26 +01:00
Howaner 7049db5bf8 Fixed compiling on linux. 2014-11-30 14:23:51 +01:00
Mattes D 201313a9f8 Added a basic stacktracing for assert and signal failures. 2014-11-29 23:06:10 +01:00
Tiger Wang 6382989ba0 Compilation fixes 2014-11-23 14:22:05 +00:00
Mattes D 5dbf601824 cEvent: Changed chrono duration resolution. 2014-11-04 15:56:27 +01:00
Mattes D 0d15261601 cEvent: Changed steady_clock to system_clock. 2014-11-04 15:47:55 +01:00
Mattes D b9777287ca Moved the chrono include into Globals. 2014-10-24 11:01:45 +02:00
Mattes D 4b32c00f66 Added a missing chrono include. 2014-10-24 10:22:17 +02:00
Mattes D 765bf006ad Merged branch 'master' into c++11. 2014-10-24 10:19:13 +02:00
Mattes D 2940ced832 Merge branch 'master' into c++11Events 2014-10-24 10:13:54 +02:00
archshift dd86c1f4a3 OSSupport/CMakeLists.txt: fixed indentation 2014-10-23 23:49:20 -07:00
Tiger Wang 51fa6b4090 Suggestions 2014-10-23 23:58:01 +01:00
archshift 8ccb729504 Fixed potential linker errors with mingw, as it isn't MSVC and it isn't APPLE. 2014-10-23 15:03:54 -07:00
archshift 6bcc2c187a Fix linking on OS X, which does not have librt. 2014-10-23 14:58:42 -07:00
Mattes D 82472d09ac Reimplemented cEvent using C++11 primitives.
Fixes #1523.
2014-10-23 11:20:25 +02:00
Mattes D f8c54f4243 Merged branch 'master' into c++11. 2014-10-23 08:40:39 +02:00
Tiger Wang a26541a7c3 En masse NULL -> nullptr replace 2014-10-22 20:12:49 -07:00
Tiger Wang 2b920f9e21 Compile fix? 2014-10-21 13:49:53 +01:00
Tiger Wang 987f79afdd En masse NULL -> nullptr replace 2014-10-20 21:55:07 +01:00
Tiger Wang a324333c11 Use std::recusive_mutex 2014-10-20 21:26:18 +01:00
Tiger Wang bde99d684e Migrated cSleep and cTimer to std::chrono 2014-10-20 18:59:40 +01:00
Tiger Wang 6d5a8892f3 Use std::thread 2014-10-19 00:29:34 +01:00
Steven Riehl 856764dee8 convert old style casts to fix warnings 2014-10-11 20:39:55 -06:00
worktycho a20bd0dbbd Update CMakeLists.txt 2014-10-05 23:44:55 +01:00
Mattes D ec71ffcc80 Added a cEvent::Wait() with timeout. 2014-10-05 19:04:30 +02:00
Mattes D c4a53c5d7d OSSupport: Fixed UNICODE Windows builds.
The files now compile even inside UNICODE applications.
2014-09-14 01:33:05 +02:00
Mattes D 52a6b30f32 Merge remote-tracking branch 'origin/master' into CraftingFixes 2014-08-28 16:53:36 +03:00
Mattes D 49ac6fadfc Fixed spaces after "template" keyword. 2014-08-28 16:44:36 +03:00
madmaxoft 1f4a1383c2 Removed an unneeded cast. 2014-08-15 07:19:13 +02:00
madmaxoft 10e58f04da Fixed windows compilation and style issues. 2014-08-12 22:43:04 +02:00
Tycho 806d0936dc First Implementatation of new Loggin framework 2014-08-10 19:34:11 +01:00
archshift 4191be7ddb Removed redundant semicolons and re-added warning 2014-07-24 11:21:37 -07:00
madmaxoft 93d29555e5 Style: Normalized to no spaces before closing parenthesis. 2014-07-21 17:40:43 +02:00
madmaxoft 6be79575fd Style: Normalized spaces after if, for and while. 2014-07-21 17:38:50 +02:00
archshift 1831c2e652 Socket: removed unused Socket destructor 2014-07-19 14:50:31 -07:00
madmaxoft 00c524519e Fixed style: spaces after commas. 2014-07-19 14:53:41 +02:00
archshift 725d1fd1e2 Subdirs: Only add_library if not using MSVC 2014-07-18 17:41:43 -07:00
archshift dcaa3262a2 OSSupport/CMakeLists.txt: Replaced glob with list of files 2014-07-18 17:41:43 -07:00
madmaxoft c03161f75d Fixed tabs used for alignment. 2014-07-17 23:16:55 +02:00
madmaxoft 5e198c6730 Basic style fixes. 2014-07-17 22:50:58 +02:00
madmaxoft 2423fbf2ef Normalized comments.
This was mostly done automatically and then visually inspected for obvious errors.
All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign.
2014-07-17 22:15:34 +02:00
madmaxoft 7177806d31 Fixed printf formats for Win builds 2014-07-01 22:48:01 +02:00
madmaxoft a5a0533d79 Fixed cFile compilation under MinGW. 2014-06-30 21:41:38 +02:00
archshift e8143de01b Nullify deleted pointers. 2014-06-19 01:49:56 -07:00
Mattes D af4a21ea06 Fixed deadlock when moving players to other worlds.
Fixes #1039, fixes #851
2014-06-08 21:58:30 +02:00
Mattes D 28815252e6 Merge branch 'master' into SslWebAdmin 2014-05-10 21:27:57 +02:00
Mattes D fb58ef55be Fixed MSVC 64-bit build warnings. 2014-05-09 18:32:03 +02:00
madmaxoft 92c022c140 Open files in shared mode on windows, so that other tools may read them.
This was the behavior before fopen_s() was used for implementation; unlike fopen(), fopen_s() opens the file in exclusive mode.
2014-05-02 20:55:50 +02:00
madmaxoft 60850fe3e8 Fixed crashes in the SSL HTTP connection. 2014-05-01 15:08:15 +02:00
madmaxoft 58929a9948 Removed the unused cBlockingTCPLink class. 2014-04-30 17:06:46 +02:00
madmaxoft 0b16e6821f Merged branch 'master' into SslWrappers. 2014-04-28 22:05:02 +02:00
Tycho a42480cf82 Template Magic
Removed need to allocate a fake meta block by using templates to provide a version
of the code that does not use metas. Also changed the function to a template
argument to make sure that the compilier is able to inline it.
2014-04-28 10:31:07 -07:00
madmaxoft f301d052cf cSocket creates the socket in Connect if no socket is present yet. 2014-04-27 22:20:49 +02:00
Mattes D a0f6149d05 Merge pull request #948 from jfhumann/staticFixes
Fixes motivated by Coverity #1
2014-04-27 17:00:37 +02:00
jfhumann a1765a2896 Fixed unitialized member in gZipFile (CID 43673) 2014-04-26 14:23:53 +02:00
archshift 80b97fd9dd Fixed mobs that don't naturally spawn. 2014-04-25 20:49:55 -07:00
archshift e47dab84f3 Cmake generated projects for IDEs include headers in project files. 2014-04-25 09:56:15 -07:00
madmaxoft f44a291da8 Fixed issues with 64-bit MSVC compilation. 2014-04-11 13:09:19 +02:00
Tycho 0075b2f72e Merge branch 'master' into HTTPSizeT
Conflicts:
	src/HTTPServer/EnvelopeParser.h
	src/HTTPServer/HTTPFormParser.h
	src/HTTPServer/MultipartParser.h
2014-04-02 07:51:48 -07:00
Tycho b449ad8613 Merge branch 'MacFixes'
Conflicts:
	src/DeadlockDetect.cpp
	src/World.cpp
2014-04-02 06:54:57 -07:00
Tycho 1f5a4a39f2 Fixed All signedness warnings in HTTPServer.cpp 2014-04-02 06:36:25 -07:00
madmaxoft 2672b14c03 More cFile warning fixes. 2014-04-01 16:00:20 +02:00
madmaxoft b9a090d835 Fixed clang warnings in cGZipFile. 2014-04-01 15:00:30 +02:00
madmaxoft 45150e9754 Fixed clang warnings in cFile.
We only support 32-bit filesizes (files < 2 GiB).
2014-04-01 14:58:05 +02:00
madmaxoft 773ce7fde6 Fixed non-virtual destructors warnings. 2014-03-28 21:35:45 +01:00
Samuel Barney eb3cc729d4 More fixes to get it to compile for me on Mac 10.9. Mostly just newline additions, but some of the unused variables were causing errors, so I wrapped them in #ifndef __APPLE__ calls, since I didn't know if they were going to be used in the future.
Also had to undefine TOLUA_TEMPLATE_BIND a couple of times.
2014-03-25 11:15:05 -06:00
Samuel Barney d77a6417f6 Added newlines. Without them, the files would not compile. 2014-03-25 10:33:52 -06:00
madmaxoft 4dc5650023 Fixed cGZipFile::ReadRestOfFile returning incorrect value. 2014-03-18 13:54:17 +01:00
Tycho cd6ab5617c Fixed xofts issues 2014-03-14 06:11:49 -07:00
Tycho 862e219443 Added additional macros to support the MSVC size_t format and changed all formats to use the macros 2014-03-12 10:34:50 -07:00
Tycho 16b27c4b7a Fixed a load of format string errors 2014-03-11 14:16:08 -07:00
Tycho 53faac10c5 Added macros to follow format string checking through wrappers 2014-03-11 13:41:15 -07:00
Tycho e2e7f2184f Fixed cast to type with different alignment in BlockingTCPLink 2014-03-10 10:48:50 -07:00
Tycho 8665233522 Fixed cast between types of different alignment in cSocket 2014-03-10 10:32:51 -07:00
Tycho e5fc3c63f2 Fix IsThread destructor 2014-03-09 10:52:12 -07:00
Tycho b480148116 Fixed warnings 2014-03-07 10:26:07 -08:00
madmaxoft 1826461884 Fixed multiple gcc warnings about unused params. 2014-02-28 16:26:23 +01:00
Tycho 462e0bcf46 fixed globals.h warnings 2014-02-23 12:23:35 -08:00
Tiger Wang fad90081d2 Fixed #491 2014-02-03 22:25:16 +00:00
madmaxoft c9916cd8c2 Fixed socket leaking. 2014-02-03 17:07:46 +01:00
madmaxoft 0b384198e5 SocketThreads: Fixed sending to closed socket. 2014-02-03 10:39:10 +01:00