Commit Graph

139 Commits

Author SHA1 Message Date
CPunch cd93a058ce shard: no longer panics if tdata/NPCs.json isn't found 2024-02-04 11:21:02 -06:00
CPunch 0a28dbcc3e removed util
- WaitWithTimeout && SelectWithTimeout have been moved to internal/testutil
- GetTime has been moved to cnet/protocol
2024-02-01 18:25:49 -06:00
CPunch 1a6de671e5 moved 'testutil' to 'internal/testutil' 2024-02-01 17:28:00 -06:00
CPunch 261ea6505f testutil: fix possible orphaned container in SetupEnvironment 2024-02-01 17:25:11 -06:00
CPunch 556878544d testutil: refactoring && cleanup
added a simple DummyPeer struct to simplify creation, send/recv and cleanup
2024-02-01 17:21:56 -06:00
CPunch bfcbe6d3d6 started testutil: login_test now uses these helpers
should simplify new tests in the future
2024-02-01 17:11:50 -06:00
CPunch e5a9ed1481 shardserver: added Service()
also, Start() now returns an error result
2024-02-01 16:53:27 -06:00
CPunch 23170093ee login_test: fix minor memory leak
defer PutBuffer so that the event packet is returned to the pool
2023-12-07 21:37:16 -06:00
CPunch 2bd61dc571 login_test: more stale comments lol 2023-12-06 20:23:29 -06:00
CPunch cba01a877d login_test: fix sendAndRecv
removed the stale typecast lol
2023-12-06 20:17:36 -06:00
CPunch e1b9fa5d99 login_test: refactor, abstracted send and recv
validation
2023-12-06 20:15:06 -06:00
CPunch 77751a2aa0 login_tests: annotate tests 2023-12-06 17:35:02 -06:00
CPunch 8e84f0c7b2 more better README
haven't decided if showing an asciinema of the docker compose
environment is really useful or informative. maybe i'll
record a GIF of some gameplay in the future
2023-12-06 17:20:58 -06:00
CPunch c902559eac LICENSE: finally added! 2023-12-06 17:19:32 -06:00
CPunch 1c40998cb6 README: oops, wrong link 2023-12-06 17:12:39 -06:00
CPunch 988368c307 added unit tests workflow badge to README 2023-12-06 17:10:39 -06:00
CPunch 01ebf4499f login_test: added TestCharacterSequence
tests the complete account/character creation sequence of packets
2023-12-06 17:08:59 -06:00
CPunch 3a14d807d2 login: minor refactoring 2023-12-06 17:08:05 -06:00
CPunch 141858d6c3 db/account: removed debug log 2023-12-06 16:40:06 -06:00
CPunch 335fdb417c fix: add player to current chunk on LOAD_COMPLETE 2023-12-05 19:17:58 -06:00
CPunch 2a6fb25f03 use passed context.Context 2023-12-04 20:45:23 -06:00
CPunch 0ebd162af0 login_test: minor cleanup 2023-12-04 20:40:48 -06:00
CPunch d1763418a8 removed useless closure 2023-12-04 20:33:53 -06:00
CPunch c4d885cf6d Login && Password need to be at least 4 long 2023-12-04 20:30:58 -06:00
CPunch afd5c9ef23 added login_test 2023-12-04 20:28:17 -06:00
CPunch ac62f7d64e moved config/ -> internal/config 2023-12-02 22:09:11 -06:00
CPunch 58afc9df1f protocol/packet: use append() w/ temp buf to grow 2023-12-02 21:54:54 -06:00
CPunch e257bf998f protocol/encrypt: minor cleanup 2023-12-02 21:53:02 -06:00
CPunch 96eed66831 add cnet/ util/ to unit-tests push event 2023-12-02 21:52:42 -06:00
CPunch 12f16645e1 updated README 2023-12-02 17:04:06 -06:00
CPunch 76e9bdf7e7 minor protocol_test.go refactor 2023-12-02 17:03:56 -06:00
CPunch 44f3b31965 start redis_test.go 2023-12-02 16:56:45 -06:00
CPunch 899b95b4e6 SelectWithTimeout && WaitWithTImeout now use time.Duration 2023-12-01 20:23:27 -06:00
CPunch e33b7c0556 util: added test 2023-12-01 20:13:53 -06:00
CPunch 3445b852fd util: added SelectWithTimeout && WaitWithTImeout 2023-12-01 20:13:42 -06:00
CPunch 557117f093 moved internal/protocol -> cnet/protocol 2023-12-01 19:56:23 -06:00
CPunch b07e9ddbcb merged internal/service -> cnet/service 2023-12-01 19:22:49 -06:00
CPunch af867ccff2 renamed cnet.CNPeer -> cnet.Peer 2023-12-01 19:15:00 -06:00
CPunch c60017f78f rename cnpeer package to cnet 2023-12-01 17:11:41 -06:00
CPunch e1804a1042 merged entity/chunk && entity/chunkposition 2023-12-01 17:03:46 -06:00
CPunch bcc999db38 moved internal/entity to shard/entity 2023-12-01 16:56:55 -06:00
CPunch e355af19ab moved internal/protocol/cnpeer to cnpeer
also started a util package
2023-12-01 15:29:19 -06:00
CPunch 0ed19ad6c5 tests workflow: add timeout
some of the tests can fail in really bad, slow ways. make sure we don't
spin our wheels waiting for a failed test to never fail.
2023-12-01 14:10:45 -06:00
CPunch 66fe3c9738 TestService: minor refactor; clearer waitgroup Add 2023-12-01 14:08:17 -06:00
CPunch 72dbfe2541 TestService: wait for OnConnect && OnDisconnect 2023-12-01 13:58:57 -06:00
CPunch 8e65a78d07 testing refactor; use github.com/matryer/is
It is syntactically pretty, simple, and also makes failures have
pretty colors. what more could you ask for :)
2023-12-01 13:49:50 -06:00
CPunch f4b17906ce more protocol/service refactor
- removed protocol.Event: CNPeers now send protocol.PacketEvents
- peer uData is held in CNPeer, use SetUserData() and UserData() to
set/read it
- Service.PacketHandler calback has changed, removed uData:
switched calls to peer.SetUserData() and peer.UserData() where appropriate
- service.Service lots of tidying up, removed dependence on old
protocol.Event.
- service.Service && protocol.CNPeer now accept a cancelable context.
hooray graceful shutdowns and unit tests!
- general cleanup
2023-12-01 00:56:34 -06:00
CPunch c0ba365cf5 CNPeer/Service refactor
- each CNPeer is given a unique chan *protocol.Event to pass events to
the service.handleEvents() loop. this is now passed to CNPeer.Handler()
as opposed to NewCNPeer().
- service has basically been rewritten. handleEvents() main loop uses
reflect.SelectCase() now to handle all of the eRecv channels for each
peer
- new protocol Event type: EVENT_CLIENT_CONNECT
- Added service_test.go; blackbox-styled testing like the others.
TestService() starts a service and spins up  a bunch of dummy peers
and verifies that each packet sent causes the corresponding packet
handler to be called.
2023-11-29 19:57:45 -06:00
CPunch d0346b2382 use proper errors for db.Err
- switch to using errors.Is where applicable
2023-11-29 19:52:10 -06:00
CPunch 18a6c5ab42 oh, this is safe actually
https://stackoverflow.com/a/23230406
2023-11-28 21:21:24 -06:00