mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 901b4a3fa7 | |||
| 25214076d8 | |||
| 3c8e277e2e |
@@ -8,13 +8,34 @@ void hs_init_with_rtsopts(int * argc, char **argv[]);
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_chat_simplex_common_platform_CoreKt_initHS(JNIEnv *env, jclass clazz) {
|
||||
// setup static arena for bump allocation and passing to RTS
|
||||
char *argv[32] = {NULL,};
|
||||
int argc = 0; // number of arguments used so far, always stands at the first NULL in argv
|
||||
// common args
|
||||
argv[argc++] = "simplex"; // fake program name
|
||||
argv[argc++] = "+RTS"; // start adding RTS options
|
||||
argv[argc++] = "-T"; // make GC counters available from inside the program
|
||||
argv[argc++] = "-A16m"; // chunk size for new allocations (less frequent GC)
|
||||
argv[argc++] = "-H64m"; // larger heap size on start (faster boot)
|
||||
argv[argc++] = "-M8G"; // keep memory usage under 8G, collecting more aggressively when approaching it (and crashing sooner rather than taking down the whole system)
|
||||
int eventlog = 1; // TODO: geto option flag from app (pointer for -ol?)
|
||||
if (eventlog) {
|
||||
argv[argc++] = "-olsimplex.eventlog"; // produce simplex.eventlog in "current" directory
|
||||
argv[argc++] = "-l-agu"; // collect GC and user events
|
||||
}
|
||||
int profiling = 1; // TODO: get option flag from app (pointer for -po?)
|
||||
if (profiling) {
|
||||
argv[argc++] = "-posimplex"; // produce simplex.hp in "current" directory
|
||||
argv[argc++] = "-hT"; // emit heap profile by closure type
|
||||
}
|
||||
int non_moving_gc = !profiling;
|
||||
#ifdef _WIN32
|
||||
int argc = 4;
|
||||
char *argv[] = {"simplex", "+RTS", "-A16m", "-H64m", NULL}; // non-moving GC is broken on windows with GHC 9.4-9.6.3
|
||||
#else
|
||||
int argc = 5;
|
||||
char *argv[] = {"simplex", "+RTS", "-A16m", "-H64m", "-xn", NULL}; // see android/simplex-api.c for details
|
||||
// non-moving GC is broken on windows with GHC 9.4-9.6.3
|
||||
non_moving_gc = 0;
|
||||
#endif
|
||||
if (non_moving_gc)
|
||||
argv[argc++] = "-xn";
|
||||
// wrap args as expected by RTS
|
||||
char **pargv = argv;
|
||||
hs_init_with_rtsopts(&argc, &pargv);
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ constraints: zip +disable-bzip2 +disable-zstd
|
||||
source-repository-package
|
||||
type: git
|
||||
location: https://github.com/simplex-chat/simplexmq.git
|
||||
tag: 246a0d10c22ebe02af2eb34773b77cce10247459
|
||||
tag: 21a9051e8bf3a0bb98cdb78b6b7653101051b5ef
|
||||
|
||||
source-repository-package
|
||||
type: git
|
||||
|
||||
@@ -86,6 +86,7 @@ executables:
|
||||
- websockets == 0.12.*
|
||||
ghc-options:
|
||||
- -threaded
|
||||
- -rtsopts
|
||||
|
||||
simplex-bot:
|
||||
source-dirs: apps/simplex-bot
|
||||
|
||||
+1
-1
@@ -423,7 +423,7 @@ executable simplex-chat
|
||||
Paths_simplex_chat
|
||||
hs-source-dirs:
|
||||
apps/simplex-chat
|
||||
ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns -threaded
|
||||
ghc-options: -Wall -Wcompat -Werror=incomplete-patterns -Wredundant-constraints -Wincomplete-record-updates -Wincomplete-uni-patterns -Wunused-type-patterns -threaded -rtsopts
|
||||
build-depends:
|
||||
aeson ==2.2.*
|
||||
, ansi-terminal >=0.10 && <0.12
|
||||
|
||||
+3
-3
@@ -359,7 +359,7 @@ startChatController mainApp = do
|
||||
setExpireCIFlag user True
|
||||
|
||||
subscribeUsers :: forall m. ChatMonad' m => Bool -> [User] -> m ()
|
||||
subscribeUsers onlyNeeded users = do
|
||||
subscribeUsers onlyNeeded users = traceSection "subscribeUsers" $ do
|
||||
let (us, us') = partition activeUser users
|
||||
vr <- chatVersionRange
|
||||
subscribe vr us
|
||||
@@ -4128,7 +4128,7 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage =
|
||||
XOk -> allowAgentConnectionAsync user conn' confId XOk -- [async agent commands] no continuation needed, but command should be asynchronous for stability
|
||||
_ -> pure ()
|
||||
CON -> startReceivingFile user fileId
|
||||
MSG meta _ msgBody -> do
|
||||
MSG meta _ msgBody -> traceSection "MSG-FileChunk" $ do
|
||||
parseFileChunk msgBody >>= receiveFileChunk ft (Just conn) meta
|
||||
OK ->
|
||||
-- [async agent commands] continuation on receiving OK
|
||||
@@ -4280,7 +4280,7 @@ processAgentMessageConn vr user@User {userId} corrId agentConnId agentMessage =
|
||||
-- 1) retry processing several times
|
||||
-- 2) stabilize database
|
||||
-- 3) show screen of death to the user asking to restart
|
||||
tryChatError action >>= \case
|
||||
traceSlow "withAckMessage" 30 (tryChatError action) >>= \case
|
||||
Right withRcpt -> ackMsg cId cmdId msgMeta $ if withRcpt then Just "" else Nothing
|
||||
Left e -> ackMsg cId cmdId msgMeta Nothing >> throwError e
|
||||
|
||||
|
||||
Reference in New Issue
Block a user