Commit graph

57 commits

Author SHA1 Message Date
turleypol
bce1154d7a
ClangTidy readability-else-after-return (#857)
* trigger tidy

* Automated clang-tidy change: readability-else-after-return

* compile test

* rerun

* Automated clang-tidy change: readability-else-after-return

* trigger..

* Automated clang-tidy change: readability-else-after-return

* manually removed a few

* Automated clang-tidy change: readability-else-after-return

* removed duplicate code

* fix remaining warnings

* fixed scope

---------

Co-authored-by: Clang Tidy <clang-tidy@users.noreply.github.com>
2026-01-18 09:35:52 +01:00
turleypol
fb3faddeae
use c++20 (#799)
* use c++20
* increased used clang version
* compiler report and logfacility use now compile time formatting, which
means that the formatstring gets checked at compile time. (which found 2 errors)
adapted a few places since report only accepts formatting arguments
adapted a few places with logging since char[] is compile time
formatting and string or chr* is runtime formatting
* use std::ranges instead of boost
* disabled pragma_assume vs specific macro (I guess noone cares)
* needed to fix ancient ms exception code
* modernized SpinLock
* removed unused code in ECompile
* replaced std::filesystem::path::u8string with string. It now returns an actual u8string type
* cleanup layers.h added the defines for other layers which where before
  only defined in the pkt
* osmod::OpenConnection and HTTPRequest cleanup: early outs, dont check for pChild which is
  only needed for startscript and placed suspend at the very last
  position

* fix warning

* rebuild cache with new compiler version

* define c++ standard for external libs where possible

* added fixme
2025-08-01 21:40:10 +02:00
turleypol
7e07fbe33a
moved polcfg to plib (#732)
removed unused remainings of incremential save
2024-11-03 14:37:38 +01:00
turleypol
2320a5dd35
Socket::has_incoming_data closes socket on error (#721)
* Socket::has_incomming_data closes socket on error
eg auxclient via OpenConnection had the problem that a closed connection
by the other side wasnt detected.
cleanup timeout params uses now milliseconds
removed old unused pollingwithselect
renamed pol.cfg entry for SingleThreadLoginServer socket timeout

* changed the default for the loginserver to single thread
Formatter defaults when no cfg can be loaded match the cfg case now.
added docs
2024-10-17 06:55:06 +02:00
turleypol
084a4e78e7
Removed PolLock when handling nonallowed pkts (#720)
* do not lock PolLock if a client sends a non-allowed pkt, this will be
only logged like undefine pkts and thus does not need the log.
added debug define to polsem.h which prints file/line of each PolLock

* extended SelectTimeout docs

* fixed debug define

* added cfg to disconnect clients if they send unknown/non-allowed pkts
during login phase

* docs
2024-10-15 17:23:02 +02:00
turleypol
cf0c730181
switched impptr to template with default type (#680) 2024-08-03 12:35:01 +02:00
turleypol
9d2bf0ec60
replaced all uppercase hex formatting with lowercase variant (#645) 2024-05-05 09:13:12 +02:00
Lukáš Novotný
d6bde75dec
Add proxy protocol support (#623)
* Add proxy protocol support

* style fix

* more style changes

* hopefully final style fixes

* Implement AllowProxy instead of UseProxyProtocol

* Style fix

* Fix initialization warning; remove unused header

* Fix boost warning (thanks @KevinEady)
2024-02-21 21:41:17 +01:00
turleypol
d848deae18
POLLOG* macros use the new formatting (#598)
* POLLOG* macros use the new formatting
removed all old logging functions

* removed old fmt lib from everything except StreamWriter
removed unneeded functions

* fixed review comments
2024-01-16 17:55:42 +01:00
turleypol
154a68a9fd
LEAKLOG, DEBUGLOG, SCRIPTLOG, FLEXLOG changed to new logging (#597)
* LEAKLOG, DEBUGLOG, SCRIPTLOG changed to new logging

* updated FLEXLOG
2024-01-13 17:08:33 +01:00
turleypol
43b776b94d
New format lib version (#592)
* renamed include guard to be able to use both format lib versions in
parallel

* build Fmt lib and link it into clib

* use std::string instead of format Writer for logging
added variant "2" for logging with new fmt lib

* use new logging variant for two logs

* always add \n to flush log, lets see if the assumption holds

* use new lib for tostring

* replaced all INFO_PRINTS in clib

* formatter for Token, BObject and BObjectImp

* started with bsccript

* use function instead of actual object for logging

* remaining bscript, started plib

* logvariant without newline added, more template magic

* format support for base types, added test for format padding
new version for fdump

* chanhed ecompile/runecl fixed compilation with ESCRIPT_PROFILE

* rewrite INFO_PRINT in plib,poltool/uoconvert/uotool

* replaced remaining INFO_PRINTS, renamed macros INFO_PRINT for logging
without newline, INFO_PRINTLN for newline addition.
Replaced also INFO_PRINT_TRACE and renamed it to INFO_PRINTLN_TRACE

* gitignore for fmt lib

* cleanup vim leftovers
2024-01-10 18:29:10 +01:00
Kevin Eady
5c969ede36
Add support for programmatically disabling inactivity timeout on a client (#458)
* Implementation of disable_inactivity_timeout

* Add documentation

* move client idle check

* fix core-changes date
2022-04-24 23:48:26 +02:00
turleypol
7ee1b64e19
replaced baseclass x,y,z,realm members with Pos4d. (#420)
* replaced baseclass x,y,z,realm members with Pos4d.
Adapted the code, no changes except making the compiler happy

* review changes

* Fixed gotten_item

* fixed copy&waste
2021-09-10 20:17:25 +02:00
Fernando Rozenblit
eb4eb8b225
Refactor Client to use private inheritance from ThreadedClient (#346)
In summary:
* Make functions in clientthread.cpp depend on ThreadedClient.
* Wrap session, packet logging and cryptengine
* Other small changes to make ThreadedClient private
2021-03-07 14:46:24 +01:00
Fernando Rozenblit
8ffc035c85
Refactor clientio process data (#342)
* Move fpLog up to ThreadedClient
* Extract send_KR_encryption_response() from process_data() into Client
* Change signature of small helper functions to use a ThreadedClient instead:
valid_message_length(), handle_unknown_packet(), handle_undefined_packet(), handle_humongous_packet() and report_weird_packet().
* Change signature of process_data() to take a ThreadedClient
2020-10-26 21:21:34 +01:00
Fernando Rozenblit
eb639587fe
Refactoring: extract client logic from threadedclient-io-step (#335)
- ThreadedClient now takes a non-const reference to its client
- Extracted has_delayed_packets()/process_delayed_packets() from io-step into ThreadedClient. They will handle speedhack prevention's movementqueue. Movementqueue might be moved later into ThreadedClient.
- Extracted should_check_idle()/warn_idle() from io-step into Client.
- Added Client::handle_msg(). It will call the appropriate packet handler. Used by process_delayed_packets() and process_data().
- Removed an old MSVC warning suppression
2020-10-04 11:53:20 +02:00
Fernando Rozenblit
62e8089281
Extract methods from threadedclient_io_finalize into client (#326)
* Extract code from threadclient_io_finalize as Client methods:
 - on_close, called when the connection is over. Returns the wait time for logoff.
 - test_logoff, called by on_close to determine how long chr must wait before logoff
 - on_logoff, called when the logoff timer expires
2020-09-25 16:45:42 +02:00
Fernando Rozenblit
b87ec21689
Split up client_io_thread by extracting functions for the io loop, io step and finalize. (#324)
Those should eventually become methods of ThreadedClient.

Moved member checkpoint up to ThreadedClient.
2020-09-24 19:18:14 +02:00
turleypol
695096213b print error also to console and not only into pol.log 2019-10-11 19:56:00 +02:00
Fernando Rozenblit
9ed6524e03 Changed socket error from an exception to only log + disconnect client 2019-10-11 19:32:05 +02:00
Fernando Rozenblit
7157c92f56 Improved connection handling:
- Linux isn't limited to 1024 connections anymore
 - Windows may have some slight performance boost

Windows XP support had to be dropped. Let us know if you still used it.
2019-04-26 20:24:30 +02:00
Fernando Rozenblit
1d256c6886 Removed one use of inet_ntoa, need to remove the rest later. There may be compatibility issues with older windows. 2019-03-08 00:12:47 +01:00
Fernando Rozenblit
ef3707affb Reorganized singlepoller code 2019-03-04 22:27:06 +01:00
Fernando Rozenblit
bc79dc046e Moved basic network files to clib 2019-03-04 21:41:27 +01:00
turleypol
d2034347e7 removed more dead singlethread functions 2019-02-22 21:02:55 +01:00
Fernando Rozenblit
f76829b206 Started refactoring the way the client thread polls sockets 2019-02-22 00:33:51 +01:00
Fernando Rozenblit
8d0909c617 Quick workaround to avoid crashing POL when too many connections are active at the same time. This will work as a soft limit of about 1000 clients on Linux until we change it to use poll() instead of select(). 2019-02-20 17:25:08 +01:00
turleypol
ceefed49ef connection log lines now not only print total number of clients but
also number of clients in login state if singlethreadlogin is active.
container used for login state is now also part of memoryusage.
2019-02-17 12:29:50 +01:00
turleypol
b541f64c6f more network specific code moved 2018-12-30 21:58:07 +01:00
turleypol
9cfb4ec5a5 moved pkt headers into network folder 2018-12-30 21:35:54 +01:00
turleypol
1f53191218 fixed critical bug in the internal clock system which prevents uptimes greater 20 days without
undefined behaviour.
Changed ReadMilliSecondClock() to return a double.
2018-10-22 20:29:55 +02:00
esdete
b9a31d3560 clang formatting 2018-07-31 16:16:19 +02:00
esdete
dc2d29b433 NULL to nullptr 2018-07-31 14:30:29 +02:00
Fernando Rozenblit
02b966d64d Refactoring to make adding entered/leftarea events to items easier 2018-06-17 17:08:00 +02:00
Gabriele Tozzi
b72f725e02 Whitespace fixes 2018-04-03 04:13:03 +02:00
turleypol
dbb25bdb62
Include and buildsystem cleanup (#45)
Include cleanup
Reworked buildsystem (Linux only)
Removed dynamic libs, Linux now again uses static linking (like windows)
2018-01-29 21:55:48 +01:00
turleypol
798eda5b63 Cleanup of header includes. 2018-01-01 21:52:14 +01:00
Fernando Rozenblit
772162d0c9 3rd time is the charm? 2017-06-10 16:09:24 +02:00
Fernando Rozenblit
c0da4e9e10 Added missing passert includes ;) 2017-06-10 15:55:50 +02:00
Fernando Rozenblit
7e7960635f Added more checks to avoid possible overflow in FD_SET 2017-06-10 15:40:08 +02:00
turley
dfccaa0ae8 avoid some copies 2016-12-15 16:59:58 +01:00
turley
a983d25e4e removed bool members and replaced them with flags.
Further decrease memory foodprint.
2016-12-07 23:34:16 +01:00
turley
f59ae94545 removed senseless function
corrected comparison
2016-03-27 00:22:44 +01:00
frozenblit
6e9de4f7e4 Fixed crashes when handling very big packets 2016-03-25 21:59:55 +01:00
frozenblit
d86cbee187 Fix bug where clients would be stuck at "Verifying account..." 2016-03-04 00:37:43 +01:00
frozenblit
324a877626 Improved ref_ptr and weak_ptr, clients are now deleted by the message queue 2016-02-28 03:51:16 +01:00
turley
d2afa82969 changed clienttransmit thread to hold a weakptr,
in addition only this thread deletes clients. should fix all
dataraces in this area.
2016-02-25 18:29:59 +01:00
turley
189cad3479 Formating everything
Authors are not forced to use the clang-format setting, but should
atleast be inspired by the style.
The only thing which is now not allowed are tabs for ident/alignment!
2016-02-19 19:26:35 +01:00
Gabriele Tozzi
ff64e3b2b4 Minor: forcing SpinLock to be used only via SpinLockGuard 2016-02-03 06:08:26 +01:00
Gabriele Tozzi
17c45a8fd2 New Client object properties last_packet_at and last_activity_at 2015-11-28 11:12:52 +01:00