27 Commits

Author SHA1 Message Date
Efim Poberezkin
660e35d1d1 check that sqlite library is compiled with threadsafe code (#63) 2021-03-02 22:30:59 +04:00
Evgeny Poberezkin
927ff230da Separate db connection for each TCP client connection (#60)
* use separate db connections for each TCP client connection

* refactor atomically, increast delay in tests

* increase test delay for SMP server to start

* increase SMP ping frequency

* remove comment

* separate SQLite connection per thread, to support multi-threaded mode

* remove redundant import
2021-02-28 14:59:29 +00:00
Evgeny Poberezkin
0fe41dbf16 Sign / verify SMP commands (#37)
* generate key pair

* crypto: sign/verify functions

* remove extension

* parse/serialize keys

* use RSA recipient/sender keys (TODO sign/verify)

* make PublicKey newtype, assign 0s to private_p & private_q

* replace SMP command parsing with Attoparsec

* rename types: Signed->Transmission, Transmission->SignedTransmission

* sign and verify commands (server tests skipped, agent tests pass)

* SMP client: avoid seralizing transmission twice when sending commands

* update SMP server tests to use command signatures

* remove support for "SEND :msg" syntax from SMP server protocol

* rename RSA module name to R to avoid confusion with C used for S.M.Crypto

* update key sizes to use bits `div` 8

* tidy up
2021-02-26 18:14:22 +04:00
Evgeny Poberezkin
4b5349fb94 Refactor END notifications (#31)
* kill TCP server client threads when the main server thread is killed; test END notification when server connection dies

* revert to using forkIO in the tests

* make subscriptions state change atomic

* remove commented out code

* Revert "revert to using forkIO in the tests"

This reverts commit c0bacd92e4.
2021-02-26 18:13:04 +04:00
Efim Poberezkin
f50da16d0a reorganize Protocol and Agent Store (#25)
* chore: move members from Server/Transmission.hs to Protocol.hs

* chore: revert qualified SMP import for server and client

* chore: fix corrId call

* chore: move common types to Common.hs

* chore: decompose SQLite.hs

* chore: rename Agent/Transmission.hs ErrorType -> AgentErrorType

* chore: move Protocol ErrorType -> Common SMPErrorType

* chore: rename Common -> Types

* chore: revert SMPErrorType -> ErrorType
2021-02-26 18:11:22 +04:00
Evgeny Poberezkin
70fe7616f2 Sending messages end to end (#21)
* duplex connection end-to-end (working, debug logs)

* agent: send, receive, acknowledge messages

* logging proposal

* logging: client/server (dis)connections

* agent scenario testing framework

* add tests, remove logs

* clean up
2021-02-26 18:11:22 +04:00
Evgeny Poberezkin
6f8b3787b0 server: refactor syntax tests to only allow one command (#5)
* server: refactor syntax tests to only allow one command

* simplify smpServerTest
2021-01-11 14:04:21 +00:00
Evgeny Poberezkin
42ab7fb6ac test against localhost 2020-12-30 21:26:46 +00:00
Evgeny Poberezkin
80b4ff365d TCP client: try all resolved addresses, not just the first 2020-12-30 21:25:49 +00:00
Evgeny Poberezkin
f3cd3eac58 add protocol version in TCP welcome 2020-12-30 18:50:50 +00:00
Evgeny Poberezkin
4b8f6417f8 add correlationId to SMP transmissions, fix tests 2020-12-28 13:55:53 +00:00
Evgeny Poberezkin
2ed24e683e rename Config to ServerConfig 2020-12-25 16:46:17 +00:00
Evgeny Poberezkin
3cb2421373 move modules to folder Simplex.Messaging.Server 2020-11-22 18:22:20 +00:00
Evgeny Poberezkin
35f83b604a rename "connection" to "queue" 2020-10-22 12:50:55 +01:00
Evgeny Poberezkin
acef2bf638 tests: deleting undelivered messages, re-delivery when message not ACKed 2020-10-18 10:15:30 +01:00
Evgeny Poberezkin
0dec506ce6 test: duplex communication over 2 SMP connections 2020-10-17 19:42:15 +01:00
Evgeny Poberezkin
eba6dfc343 make sizes of IDs a server configuration 2020-10-17 18:13:20 +01:00
Evgeny Poberezkin
98a85ddf5d load 3 lines before parsing 2020-10-17 17:29:23 +01:00
Evgeny Poberezkin
3255682bf2 use base64 encoded IDs and bytestrings instead of strings 2020-10-17 15:01:25 +01:00
Evgeny Poberezkin
5a0402d0c4 random connection and message IDs 2020-10-17 11:07:09 +01:00
Evgeny Poberezkin
ee40927506 random connection and message IDs 2020-10-17 11:03:38 +01:00
Evgeny Poberezkin
7cb289e88a refactor: TCP transport 2020-10-15 07:08:21 +01:00
Evgeny Poberezkin
2ba27ed852 SECURE command, tests 2020-10-14 21:03:37 +01:00
Evgeny Poberezkin
c7e194d3c7 replace TChan with TBQueue 2020-10-14 14:37:29 +01:00
Evgeny Poberezkin
1daae74c67 syntax tests for all commands 2020-10-13 18:44:40 +01:00
Evgeny Poberezkin
00f61c1f68 protocol syntax tests 2020-10-13 18:17:41 +01:00
Evgeny Poberezkin
e75a3c44df test client (WIP) 2020-10-13 12:43:44 +01:00