Commit Graph

41 Commits (368a073415064957c292242483e2967a4c3e28b3)

Author SHA1 Message Date
Peter Wortmann 88ef1d40fa Warning fixes
Actually pretty sure a few of them were bugs
2015-08-31 19:52:39 +01:00
Nicolas Hake 5562b09dc4 Remove a lot of disabled legacy code, round 2
Maybe at some point we'll be rid of all the commented-out code that
nobody has looked at in years.
2015-03-25 20:02:53 +01:00
Sven Eberhardt efcdf6fa68 Fix hanging network thread due to timing calculation errors in UDP network class.
GetNextTick() may sometimes return a tick in the past, which calculations need to consider.

This might also fix #1076.
2014-05-18 13:41:47 +02:00
Martin Plicht e02b2d425f C4NetIO: #ifdef __APPLE__, not APPLE 2014-02-16 14:54:26 +01:00
Martin Plicht 61cd4271c9 C4NetIO: mac: To be on the safe side, only activate poll timeout cap when APPLE 2014-02-16 10:54:24 +01:00
Martin Plicht aee2e358ca C4NetIO: Place silly poll timeout fix where it actually helps in case of UDP 2014-02-16 10:18:45 +01:00
Martin Plicht 09e1a47cf9 C4NetIO: Endless polls cut short by cheap hack 2014-01-27 14:22:22 +01:00
Martin Plicht d504626a40 StdScheduler: Split into StdSchedulerWin32/StdSchedulerPoll/StdSchedulerMac 2014-01-23 17:53:40 +01:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
Tobias Zwick 5bcd762206 C4TimeMilliseconds returns a StdCopyStrBuf to avoid memory errors 2013-12-09 00:49:58 +07:00
Tobias Zwick e9eea97864 make rest of the code not use C4TimeMilliseconds-pointers but instead use the infinity field. 2013-12-09 00:49:57 +07:00
Tobias Zwick bdc895655d add AsString method to C4TimeMilliseconds 2013-12-08 16:28:58 +07:00
Tobias Zwick fe2a400c02 replace global function GetTime() with class function C4TimeMilliseconds::Now() 2013-12-07 21:27:01 +07:00
Tobias Zwick 94c618d153 add new type C4TimeMilliseconds for time measurements to solve problems when GetTime() overflows (#251)
The new type C4TimeMilliseconds behaves for the most part like a uint32_t but is overflow-proof in comparisons.
In some places, a 0-value (or uint_max) of the variable storing the time had the special meaning "not set yet". This has been resolved by having it as a pointer to C4TimeMilliseconds with NULL meaning that it has not been set yet.
2013-12-04 19:35:07 +07:00
Tobias Zwick c03effd104 fix possible bug: pPeer->GetTimeOut() already includes GetTime() + some offset, adding GetTime() another time here is wrong. 2013-12-04 14:35:17 +07:00
Tobias Zwick a8a8322dfb use %u to format unsigned ints (times) 2013-12-04 12:51:46 +07:00
Tobias Zwick 7de660ba79 fix possible bug: respect iMaxTime parameter in C4NetIOUDP::Execute 2013-12-04 12:46:07 +07:00
Tobias Zwick 7b9c1d5a9e refactor: consistently use time_t t... variables for times in network system, scheduler, gui
The network used to cast GetTime() to int, but GetTime() is an unsigned long. This might cause problems if GetTime() returns big integers (see #251). To solve this, the StdSchedulerProc interface had to be extended with another function in order to eliminate the magic return value -1 of GetNextTick for "no scheduled execution".
2013-11-29 17:28:04 +07:00
Peter Wortmann 43bbcecd99 Ignore "would block" errors from UDP sendto
Given that SimpleUDP makes no promises on delivering data anyway, it's okay
to just drop packets silently.

While I'm at it, it's probably a good idea for non-Windows system to
set sockets as non-blocking too, as well as C4NetIOUDP to be more
consistent with its handling of errors along these lines.
2013-03-07 21:26:32 +00:00
Nicolas Hake 102ac08c2e Don't assume char to be unsigned when generating packet header
OR'ing an enum value and a char with its highest bit set sign-extends the char.
On compilers with signed chars, this means you end up with a negative integer,
which can't be narrowed to uint8_t at initialization (which is what PacketHdr's
first member is).
2012-11-17 22:53:56 +01:00
Peter Wortmann afe653baae Use uint8_t consistently for UDP status packet byte
Thanks to pkern for spotting this.
2012-11-17 17:40:00 +00:00
Günther Brammer 1929e8d779 linux: add CLOEXEC flag to miscellaneous calls 2012-03-05 02:48:27 +01:00
Günther Brammer 3755a36dd1 linux: Add SOCK_CLOEXEC to socket calls 2012-03-11 00:50:51 +01:00
Nicolas Hake a04b06f98f NetIO: Cast test packet payload to unsigned
rand() returns a signed integer, while the PacketHdr structure
has an unsigned packet number field. According to ISO/IEC 14882,
implicitly narrowing a value type in an initializer list is not
allowed [dcl.init.aggr p2].
2011-09-28 00:56:11 +02:00
Günther Brammer 9bc61db360 copyright notices update 2011 2011-09-01 16:58:52 +02:00
Günther Brammer 6c2a89eaf8 Replace timeGetTime with a platformneutral GetTime wrapper 2011-03-13 17:25:35 +01:00
Günther Brammer 040ebfa612 Replace ZeroMemory(p,l) with memset(p,0,l) 2011-03-12 14:59:41 +01:00
Günther Brammer be342d4a51 copyright notices update 2010
This time with more manual checking and using git blame -M -C, so that
a few cases of copied code get a copyright notice corresponding to
their initial introduction.
2010-12-23 01:01:24 +01:00
Armin Burgmeier 9f65838ae8 Fix a couple of compiler warnings 2010-04-28 23:43:25 +02:00
Armin Burgmeier d52fd9eadb Pass correct poll result (revents) to glib mainloop
This fixes saving games in developer mode on Linux
2010-03-31 19:14:10 +02:00
Benjamin Herr 4378de147c Rerun astyle with missing \ added 2010-03-28 20:58:01 +02:00
Günther Brammer b4e37b070b Change all indentation with spaces to use tabs instead
This is a whitespace-only patch. Hopefully, it'll only affect rarely-changed
parts of the engine, since all regularly maintained pieces should already
use tabs.
2010-03-27 17:05:02 +01:00
Günther Brammer ff8d950e85 Remove C4ENGINE define
Most files using it weren't used by c4group-the-application anymore, and
the remaining stuff can be dealt with by using stubs or the same code in
both cases.
2010-02-17 22:59:46 +01:00
Benjamin Herr 00c747aebe C4NetIOTCP: Removed assertions from bug #101
The non-winsock part of the code was making some funny assumptions about
the the connection/peer lists staying consistent with the pollfd array,
so we use a pollfd map instead.
---
 src/network/C4NetIO.cpp |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)
2010-02-02 16:41:18 +01:00
Benjamin Herr df0ff9ef00 C4NetIO::Execute: Extend std::vector lifetime as something points to it
In the not-STDSCHEDULER_USE_EVENTS case, the fds pointer will point to
the elements of a vector with automatic storage duration and then
outlive its lifetime, causing undefined behaviour.
---
 src/network/C4NetIO.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
2010-02-02 15:22:33 +01:00
Benjamin Herr f3b35227ea avoid lots of gcc warnings 2010-01-25 05:00:59 +01:00
Günther Brammer bf1b347d1a netio error message fix 2009-11-03 00:59:27 +01:00
Sven Eberhardt 8b4006da08 fix scheduler blocking by unblock proc 2009-12-31 18:10:55 +01:00
mizipzor a53dae0c1b Fixed compilation in MSVC2010 2009-11-25 19:38:54 +01:00
Nicolas Hake 52bde5a579 Remove BIG_C4INCLUDE define 2009-10-20 06:21:12 +02:00
Günther Brammer 572d00c32e Move all source files
This might make stuff easier to find.
2009-08-10 17:59:18 +02:00