Commit Graph

1247 Commits

Author SHA1 Message Date
Evgeny Poberezkin 17b429afe7 handle TCP disconnections (WIP) (#29)
* handle TCP disconnections (WIP)

* agent: handle SMP server disconnections

* agent: notify client about lost subscriptions when SMP server disconnects

* comments for testing functions

* remove test apps

* chore: reorder functions in Transport

* add comment

Co-authored-by: Efim Poberezkin <efim.poberezkin@gmail.com>
2021-02-26 18:13:04 +04:00
Efim Poberezkin e09d3bae99 agent store: move SQLite Types -> Util (#30) 2021-01-25 20:14:33 +04:00
Evgeny Poberezkin d719b741dc suspend and delete connection (#28)
* suspend and delete connection

* agent: OFF/DEL tests, infix operators in tests

* test for subscriptions
2021-02-26 18:11:22 +04:00
Evgeny Poberezkin 19dc7b3389 subscriptions (#27)
* subscribe connection and track subscriptions

* notify client when subscription ENDs

* tcp connection timeout

* move types
2021-02-26 18:11:22 +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 d82c286a54 Logging (#24)
* logging with simple-logger

* refactor Agent.Client

* move logging to Agent.Client

* clean up

* log command name only
2021-02-26 18:11:22 +04:00
Evgeny Poberezkin c30a4cd1ff sql quasi-qouter (#26) 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 65dd693c83 parse agent messages with attoparsec (#18)
* parse agent messages with attoparsec (WIP)

* agent: refactor parsers

* agent: parse commands and responses with attoparsec

* refactor UTCTime parser

* fix: updateRcvQueueStatus args

* remove outdated comment

* message parsing: PR feedback

Co-authored-by: Efim Poberezkin <efim.poberezkin@gmail.com>
2021-02-26 18:11:22 +04:00
Evgeny Poberezkin d47b57ac87 correct variable name 2021-02-26 18:11:22 +04:00
Efim Poberezkin c14b0251d5 agent store: add getReceiveQueue 2021-02-26 18:11:22 +04:00
Efim Poberezkin 8ab79b066d agent store: add update queue methods (#19) 2021-02-26 18:11:22 +04:00
Evgeny Poberezkin 10fb667ff3 Receive messages (#17)
* framework to parse and process agent messages

* update SMPClient functions to accept private key

* process messages (WIP)

* agent: create reply queue and send REPLY message with qInfo

* refactor agent commands

* refactor processSMPTransmission

* agent: logic to process REPLY message
2021-02-26 18:11:22 +04:00
Efim Poberezkin c1f15c9d93 tests: randomize db file name to fix io errors (#16)
* tests: check file doesn't exist in store tests after

* Revert "tests: check file doesn't exist in store tests after"

This reverts commit de624433a9.

* [WIP] tests: randomize db file

* [WIP] tests: try runIO to get filename into after

* random db file name for agent tests

* tests: randomize DB file name

* tests: increase SMP agent start delay

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2021-02-26 18:11:22 +04:00
Evgeny Poberezkin 3efb15ecb3 receiving messages and remaining client functions (#15)
* SMPClient queues for messages and notifications

* style

* SMPClient: put all messages (and uncorrelated server commands) to provided TBQueue
2021-02-26 18:11:22 +04:00
Efim Poberezkin 5f59fcc969 agent store: add createMsg (#14) 2021-01-15 19:30:11 +04:00
Evgeny Poberezkin 72a1082822 SMPClient returns errors via ExceptT (#13) 2021-02-26 18:09:26 +04:00
Evgeny Poberezkin 2e6ba85308 SMP client library (#9)
* functions to send SMP commands and receive responses

* refactor agent: use SMPClient

* fix tests, remove ServerClient.hs

* refactor processCommand

* fix Agent.hs

* fix SMPClient, tests

* "forever" to SMPClient process
2021-02-26 18:09:26 +04:00
Efim Poberezkin b02bd42f84 ci: cache dependencies (#11) 2021-02-26 18:09:26 +04:00
Evgeny Poberezkin 02a15f9f25 agent tests (#8) 2021-02-26 18:09:26 +04:00
Efim Poberezkin 1c5325babf agent store: add positive updateQueueStatus tests for snd and rcv conns (#10) 2021-01-12 19:01:53 +04:00
Evgeny Poberezkin 241e3a29a8 Merge pull request #1 from simplex-chat/client
SMP agent implementation
2021-01-12 08:45:38 +00:00
Evgeny Poberezkin 7522d8b24f readme: link to releases 2021-01-11 19:25:37 +00:00
Evgeny Poberezkin df16ce1dfc rename workflow, build/version badges 2021-01-11 19:23:36 +00:00
Evgeny Poberezkin 26007818ff readme: released version link 2021-01-11 19:14:54 +00:00
Evgeny Poberezkin 253f4e39c9 JOIN command (#4)
* parse JOIN command

* parse JOIN command

* serialize NEW command

* parse and serialize CON response

* process JOIN command: SEND confirmation (WIP)

* process response to the confirmation from JOIN command

* remove comment
2021-01-11 18:31:10 +00:00
Efim Poberezkin 75570350a8 GitHub workflow for tests (#7)
* ci: add github workflow for tests

* ci: break test

* ci: fix folder name

* ci: fix test

* ci: break test

* fix test

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
2021-01-11 22:21:35 +04:00
Efim Poberezkin f91e0c7387 Merge pull request #6 from simplex-chat/update-queue-status-tests
agent store: add updateQueueStatus tests
2021-01-11 20:33:20 +04:00
Efim Poberezkin 123fe0e3e2 agent store: adjust tests hierarchy 2021-01-11 20:28:20 +04:00
Efim Poberezkin 7f22dcd496 agent store: add updateQueueStatus tests 2021-01-11 19:34:30 +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
Efim Poberezkin f5aaab3861 agent store: fix updateQueueStatus 2021-01-10 23:43:57 +04:00
Efim Poberezkin b9cdc6a09d agent store: add updateQueueStatus; TODO finalize, tests 2021-01-10 16:08:19 +04:00
Evgeny Poberezkin ef028c135d agent SQLiteStore: method stubs 2021-01-09 20:54:41 +00:00
Evgeny Poberezkin 394803b3cf remove/fix compiler warnings 2021-01-09 20:48:07 +00:00
Evgeny Poberezkin ea6496ca24 better MonadUnliftIO instance for ExceptT; fix tests 2021-01-09 20:35:19 +00:00
Evgeny Poberezkin d1c5e9df7b agent: ErrorType constructor for store errors, exceptions are caught 2021-01-09 19:55:42 +00:00
Evgeny Poberezkin 3dbdb948ae agent: respond with INV (TODO: store exception blows up; select does not work without port 2021-01-09 19:23:32 +00:00
Evgeny Poberezkin a1c4ce6448 refactor store: simplify 2021-01-09 13:04:13 +00:00
Evgeny Poberezkin 0d0a12f778 refactor store: m (Either e a) => ExceptT e m a 2021-01-09 11:18:52 +00:00
Evgeny Poberezkin 75f58f8ba4 remove unnecessary bindings 2021-01-09 08:31:21 +00:00
Efim Poberezkin af5bd101cb agent store: make create connection methods return () 2021-01-08 15:51:33 +04:00
Efim Poberezkin 19238c6cc4 agent store: add deleteConn and tests 2021-01-07 17:58:46 +04:00
Efim Poberezkin 6dff023965 test: set up and tear down db per test 2021-01-07 14:51:49 +04:00
Efim Poberezkin e692cb0119 add addRcvQueue and tests 2021-01-07 14:00:53 +04:00
Evgeny Poberezkin 51cc602bdb agent store: refactor addSndQueue 2021-01-06 20:22:00 +00:00
Efim Poberezkin 5a6b1c67a9 add test testAddSndQueue 2021-01-06 23:01:53 +04:00
Efim Poberezkin 94d0be5d27 add test for addSndQueue 2021-01-06 22:35:04 +04:00
Efim Poberezkin 61092e8371 add implemented addSndQueue 2021-01-06 22:11:55 +04:00
Efim Poberezkin 1c32fccb39 [WIP] add addSndQueue 2021-01-06 18:03:55 +04:00