on master help sign in
add Logout handler
commit8a314ddde64c92533653b6a018f35d32aacf825d authorAgentM <agentm@themactionfaction.com> dateFri 3 Feb 2017, 17:02 (10 years ago) parentc8ffbf4
2 files changed+13−3
src/lib/ProjectM36/Server.hs+6−3 src/lib/ProjectM36/Server/EntryPoints.hs+7
src/lib/ProjectM36/Server.hs+6−3
@@ -40,9 +40,11 @@ serverDefinition testBool ti = defaultProcess {
4040 handleCall (\conn (RetrieveAtomTypesAsRelation sessionId) -> handleRetrieveAtomTypesAsRelation ti sessionId conn),
4141 handleCall (\conn (RetrieveRelationVariableSummary sessionId) -> handleRetrieveRelationVariableSummary ti sessionId conn),
4242 handleCall (\conn (RetrieveCurrentSchemaName sessionId) -> handleRetrieveCurrentSchemaName ti sessionId conn),
43− handleCall (\conn (ExecuteSchemaExpr sessionId schemaExpr) -> handleExecuteSchemaExpr ti sessionId conn schemaExpr)
43+ handleCall (\conn (ExecuteSchemaExpr sessionId schemaExpr) -> handleExecuteSchemaExpr ti sessionId conn schemaExpr),
44+ handleCall (\conn Logout -> handleLogout ti conn)
4445 ] ++ testModeHandlers,
45− unhandledMessagePolicy = Log
46+ unhandledMessagePolicy = Terminate
47+ --unhandledMessagePolicy = Log
4648 }
4749 where
4850 testModeHandlers = if not testBool then
@@ -68,7 +70,7 @@ registerDB dbname = do
6870 self <- getSelfPid
6971 let dbname' = remoteDBLookupName dbname
7072 register dbname' self
71− liftIO $ putStrLn $ "registered " ++ (show self) ++ " " ++ dbname'
73+ --liftIO $ putStrLn $ "registered " ++ (show self) ++ " " ++ dbname'
7274
7375-- | A notification callback which logs the notification to stderr and does nothing else.
7476loggingNotificationCallback :: NotificationCallback
@@ -94,6 +96,7 @@ launchServer daemonConfig mAddressMVar = do
9496 Left err -> hPutStrLn stderr ("Failed to create transport: " ++ show err) >> pure False
9597 Right endpoint -> do
9698 localTCPNode <- newLocalNode transport remoteTable
99+ --traceShowM ("newLocalNode in Server " ++ show (localNodeId localTCPNode))
97100 runProcess localTCPNode $ do
98101 let testBool = testMode daemonConfig
99102 reqTimeout = perRequestTimeout daemonConfig
src/lib/ProjectM36/Server/EntryPoints.hs+7
@@ -125,8 +125,15 @@ handleExecuteSchemaExpr ti sessionId conn schemaExpr = do
125125 ret <- timeoutOrDie ti (executeSchemaExpr sessionId conn schemaExpr)
126126 reply ret conn
127127
128+handleLogout :: Timeout -> Connection -> Reply Bool
129+handleLogout _ conn = do
130+ --liftIO $ closeRemote_ conn
131+ reply (pure True) conn
132+
128133handleTestTimeout :: Timeout -> SessionId -> Connection -> Reply Bool
129134handleTestTimeout ti _ conn = do
130135 ret <- timeoutOrDie ti (threadDelay 100000 >> pure True)
131136 reply ret conn
137+
132138
139+