spaced4ndy
cf147397a4
xftp: agent receive file ( #637 )
...
* xftp: agent receive file draft
* receiveFile more stubs, changes to types, schema
* cabal file
* comments
* xftp_server_id
* schema changes, get client, local worker/action
* agent env, save file description, adjust schema
* client stubs
* download chunk wip, store, schema, types
* remove commented code
* read file description, schema, types
* check received, decrypt
* remove pure
* todo
* add XFTP to agent client
* add user id
* agent test
* tests
* rename supervisor into agent
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2023-03-03 18:50:16 +04:00
spaced4ndy
733c9374bf
fix comment ( #645 )
2023-02-20 11:35:01 +04:00
spaced4ndy
c0dcf283eb
server_key_hash fields ( #643 )
...
* server_key_hash fields
* test
* refactor
* fix
* order
* use sync command in test
* refactor
---------
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2023-02-17 21:24:32 +00:00
Evgeny Poberezkin
cfe995325a
agent: prevent batch deletions from failing on one connection sql error ( #628 )
...
* agent: prevent error reading one connection failing batched subscription
* prevent batch deletions from failing on one connection sql error
* rename
2023-02-04 20:46:45 +00:00
Evgeny Poberezkin
7fb48930f6
increase database transaction timeout, add test for user deletion ( #622 )
...
* increase database transaction timeout, add test for user deletion
* more test logs
2023-01-25 20:58:03 +00:00
Evgeny Poberezkin
2ccef1690b
events sent by the agent when queue, connection and user are deleted asynchronously ( #619 )
...
* events sent by the agent when queue, connection and user are deleted asynchronously
* update test
* more tests
* add user tests
* queries
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
2023-01-24 11:12:07 +00:00
Evgeny Poberezkin
d4fc638478
async batch connection deletion ( #617 )
...
* async batch connection deletion
* delete user record with connections, async connection deletion
* updates
* update query
2023-01-21 13:41:16 +00:00
Evgeny Poberezkin
a854b5f2b2
batched queue deletion ( #611 )
...
* batched queue deletion
* only re-connect client on subscribe errors, not in all batch commands
* add test, fix
* correction
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
* refactor
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
2023-01-19 16:53:28 +00:00
Evgeny Poberezkin
324e01300d
execute asynchronous commands for correct users, include session in messages from SMP clients to agent ( #608 )
...
* execute asynchronous commands for correct users
* pass transport session to message processing to avoid race condition
* account for server changes when determining unused servers
* enable one test
* enable all tests, remove log
2023-01-16 11:06:19 +00:00
JRoberts
8e024590bc
fix createUserRecord query ( #604 )
2023-01-13 11:31:35 +04:00
Evgeny Poberezkin
f4ad3a983e
support users in agent to isolate traffic of different users ( #598 )
...
* users table, isolate traffic sessions by users or by queues
* remove extra indices
* corrections
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
2023-01-11 17:47:20 +04:00
Evgeny Poberezkin
8d9816809f
simplify queue rotation protocol ( #550 )
...
* simplify queue rotation protocol
* use simplified rotation protocol, update tests
* simplify schema
* delete all connection queues
* refactor
* switch notifications to the new queue, tests
* remove TODO
* refactor
* rfc correction
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
* remove duplicate set active
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
2022-10-31 13:33:28 +04:00
Evgeny Poberezkin
eb5c1c78cb
connection queue redundancy and rotation ( #521 )
...
* rfc: queue rotation
* update rfc
* messages for queue rotation
* allow multiple subscribed queues per connection in Agent/Client.hs
* refactor
* fix module name
* allow multiple queues in duplex connection type
* update commands
* add indices
* addConnectionRcvQueue
* switch connection to another queue (WIP)
* update schema/protocol
* switching queue works, but sending messages after the switch fails
* messages are delivered after rotation
* use connection-scoped queue ID
* rename queue records fields
* refactor using SMPQueue class/instances
* simplify queries
* QKEY: check queue is not secured, refactor
* update rfc
* mark queue as primary in QUSE
* queue rotation errors
* fix async ack
* fix async ACK to send OK
* correction
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
* use SWCH command
* rename
* take into account only active queue subscription when determining connection result if at least one queue is active
* remove comment
* only enable notifications for connections with enableNtfs = True
* async test (WIP)
* async queue rotation test
* simplify combining results
* test with 2 servers
* fix unused subscribeConnection
* switch to cabal build
* increase build timeout
* increase delay in async test
* skip queue rotation tests
* build matrix
* step name
* use ubuntu-18.04 in build matrix
* enable rotation tests
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
2022-10-29 18:57:01 +01:00
Evgeny Poberezkin
29332a5e9f
lints ( #539 )
...
* lints
* revert
* add import
* remove StrictData
2022-10-01 11:51:52 +01:00
Evgeny Poberezkin
f8505d4add
make function processing sql rows module-level ( #533 )
2022-09-22 12:12:24 +01:00
Evgeny Poberezkin
abb3f20ed5
replace TVar with IORef in execSQL ( #531 )
2022-09-18 13:25:06 +01:00
Evgeny Poberezkin
a3f58fdc6b
api to execute any sql query ( #529 )
...
* api to execute any sql query
* agent api
2022-09-17 15:08:58 +01:00
Evgeny Poberezkin
e3e05d474d
wrap agent command for async command processing, to allow extension with internal commands ( #528 )
...
* wrap agent command for async command processing, to allow extension with internal commands
* change encoding for constructor
2022-09-17 14:08:49 +01:00
Evgeny Poberezkin
afecefc3ad
Merge branch 'master' into sqlcipher
2022-09-14 18:22:46 +01:00
Evgeny Poberezkin
bab6a1577b
correlation IDs and command tags for async commands ( #519 )
...
* agent protocol command tags
* store/send async command correlation IDs
* fix, refactor
* delete failed command
2022-09-10 16:33:15 +01:00
JRoberts
882d2b123b
agent async commands ( #513 )
...
* wip
* wip
* wip
* wip
* don't delete conn on join failure in async mode
* test restart
* remove unused pragma
* simplify restore
* rename variable
* refactor
* refactor
* split
* remove error
* prohibit async join via contact request
* refactor subscribeConnections
* simplify
* resum command processing on subscriptions
* unfocus tests
* schema
* remove do
* rename variable
* corrections
* move code
* refactor getPendingCommands
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2022-09-08 20:27:56 +04:00
Evgeny Poberezkin
50c210c5c0
remove database key from SQLiteStore ( #514 )
2022-09-05 12:55:14 +01:00
Evgeny Poberezkin
e4b47825b5
functions to create and close store ( #512 )
2022-09-02 15:42:37 +01:00
Evgeny Poberezkin
26d149d17c
interpolate sql strings ( #510 )
2022-08-31 17:57:38 +01:00
Evgeny Poberezkin
e4b77ed9e6
use SQLCipher ( #507 )
...
* use SQLCipher
* pass database key via options, use local direct-sqlcipher and sqlcipher-simple
* update stack.yaml
* use dependencies in git
* update sqlcipher dependencies
2022-08-30 12:31:41 +01:00
Evgeny Poberezkin
1459a0613a
set invitation as not accepted in case of join error ( #505 )
...
* set invitation as not accepted in case of join error
* remove unused name
2022-08-25 12:17:55 +01:00
Evgeny Poberezkin
212a9bc4ab
enable/disable connection notifications ( #501 )
...
* enable/disable connection notifications
* filter connections when intializing/disabling subscriptions
* fix
* fix 2
* add delay
* increase test delay
* increase test delay
* fix
* increase test delays
* increase test delays
2022-08-19 15:23:57 +01:00
Evgeny Poberezkin
68138c08d2
support multiple server hostnames per queue ( #494 )
...
* store SMP client version per queue
* use versioned format for queue addresses (not compatible with v1)
* multiple server hosts in queue URI/data, versioned encoding (cross-version tests fail)
* choose server host based on socksProxy setting
* test works
* multiple server addresses mostly work
* add onion hosts for provided servers
* update SMP hosts
2022-08-12 11:32:04 +01:00
Evgeny Poberezkin
abd694bd5a
parameterize protocol server by scheme ( #459 )
2022-07-05 21:56:14 +01:00
Evgeny Poberezkin
4c0164c49e
fix: support msgFlag NULL in sql ( #458 )
2022-07-03 13:05:16 +01:00
JRoberts
0392f849aa
ntf: reset subscription on SCHK AUTH error; launch only required workers ( #449 )
2022-07-01 13:19:56 +04:00
JRoberts
16f5fdeeb0
ntf: delete notifier creds on NSASmpDelete ( #447 )
...
* ntf: delete notifier creds on NSASmpDelete
* fix
2022-07-01 09:18:01 +01:00
JRoberts
c3012173e3
ntf: recover from failed/in-deletion subscriptions ( #446 )
...
* ntf: recover from failed/in-deletion subscriptions
* check NASNew status on subscription recover
* carryOnWithDeletion
* logs
* SCHK
2022-06-30 20:18:12 +04:00
JRoberts
c82fae72f2
ntf: refactor NtfSubAction ( #445 )
2022-06-30 15:34:16 +04:00
JRoberts
9695786aa5
ntf: separate types into their own module ( #444 )
2022-06-30 14:31:36 +04:00
Evgeny Poberezkin
56ef95e8ae
ntf: fix null action ts ( #443 )
...
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com >
2022-06-30 14:01:34 +04:00
JRoberts
3d6ad64d62
ntf: registerNtfToken rework, notification modes ( #431 )
...
* check mode for new subscriptions
* check token inside actions
* migration - apple -> apns
* wip
* register logic, modes
* update mode, cron config, verify token changes
* refactor
* fix test
* NTFMODE
* server: delete subscriptions on deleteToken
* refactor markNtfSubscriptionForDeletion
* remove NTFMODE
* remove subscriptions when token is deleted
* refactor
* lint
* test
* check ntfMode
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2022-06-27 21:54:35 +04:00
JRoberts
2809963a2e
ntf: register token with NotificationsMode ( #429 )
2022-06-25 17:34:08 +04:00
JRoberts
70e7c71762
ntf: read rcv queue separately from ntf subscription, fix deletion race condition ( #423 )
2022-06-24 16:51:42 +04:00
JRoberts
a92827c986
ntf: notification server SDEL command; subscription deletion in agent ( #421 )
2022-06-23 17:05:43 +04:00
JRoberts
7a72488275
ntf: use separate key to encrypt NMsgMeta ( #410 )
...
* ntf: use separate key to encrypt NMsgMeta
* key negotiation
* save key on server, use for encryption
* refactor?
* store error
* NtfQueueCreds
* server - NtfCreds
* comment, rename
* fix type
* ClientNtfCreds
* encoding
2022-06-20 17:16:26 +04:00
Evgeny Poberezkin
d1db7d6f79
withStore runs in a single transaction ( #408 )
...
* remove store typeclass
* make withStore run single transaction
* combine 2 store calls
* refactor
* add exports
* fix catch
* correction
2022-06-18 18:01:04 +01:00
JRoberts
ec70429106
ntf: getNotificationMessage' ( #406 )
...
* ntf: getNotificationMessage'
* refactor
* ntfTs
* fix parser
* length
* fix test
* fix encryption, test
* remove test focus
* getActiveNtfToken
* rename
* Update src/Simplex/Messaging/Protocol.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* getNtfRcvQueue
* refactor
* don't fail
* Update src/Simplex/Messaging/Notifications/Protocol.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* Update src/Simplex/Messaging/Notifications/Server.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* Update src/Simplex/Messaging/Server.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* import
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2022-06-18 18:21:35 +04:00
JRoberts
3336f987c3
ntf: SCHK, cancel actions on errors, wait until action ts before executing ( #402 )
...
* SCHK
* NSACheck
* updateSubFutureTs
* dont execute too early
* fix diffTimeToMillis
* rename function
* errors
* nested status
* increase ntfSubCheckInterval
* adjust import
* Update src/Simplex/Messaging/Agent/NtfSubSupervisor.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* Update src/Simplex/Messaging/Agent/NtfSubSupervisor.hs
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
* refactor rescheduleAction
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2022-06-16 16:11:46 +04:00
Evgeny Poberezkin
5f94240ed4
remove DB connection pool to prepare for using semaphores ( #400 )
2022-06-15 14:11:03 +01:00
JRoberts
331918bac7
ntf: agent tests ( #399 )
2022-06-15 14:22:55 +04:00
JRoberts
f7bd8a3982
ntf: agent ntf workers implementation, store methods ( #394 )
2022-06-14 14:34:18 +04:00
Evgeny Poberezkin
62485b9367
re-deliver duplicate message if it was not acknowledged by the user, ignore otherwise ( #397 )
...
* re-deliver duplicate message if it was not acknowledged by the user, ignore otherwise
* delete message after ACK
2022-06-13 08:27:08 +01:00
JRoberts
9c12b4edc0
ntf: agent spike, NtfSupervisor ( #392 )
...
Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com >
2022-06-10 16:35:06 +04:00
Evgeny Poberezkin
c1348aa54f
SMP connection handshake v2 ( #390 )
...
* SMP connection handshake v2
* hadshake v2 [mostly] works
* all tests pass, some race conditions remain
* fix build
* fix race conditions, send CON after all HELLOs in duplexHandshake mode
* add comments
* comment
* add comments
2022-06-09 13:47:07 +01:00