diff options
author | Haskell Guy <haskell.guy@localhost> | 2020-05-28 14:59:58 +0200 |
---|---|---|
committer | Haskell Guy <haskell.guy@localhost> | 2020-05-28 14:59:58 +0200 |
commit | dd39bdc8c23734f35fbf3bc3250ee3ff03724772 (patch) | |
tree | 2954bfe79f861898db76b56ac856fa9d223fc517 | |
parent | 7e6e3e3ebd61b2e095f32bd8d5d4c93ff66e3108 (diff) | |
download | ssb-haskell-dd39bdc8c23734f35fbf3bc3250ee3ff03724772.tar.xz |
Fix Room hosting
- Use the correct RPC handler for when the 'host-room' command is used.
- Avoid making clients hang up by returning OK when the rpc endpoint
call is unknown.
-rw-r--r-- | app/Main.hs | 2 | ||||
-rw-r--r-- | src/Ssb/Peer/RPC/Room.hs | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/app/Main.hs b/app/Main.hs index 47d86c7..a9a05f9 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -109,7 +109,7 @@ hostRoomCMD name desc hostname = do Room.Invite { host = hostname, port = "8008", key = publicKey me } putStrLn $ "Hosting room for '" <> Room.formatInvite roomInvite <> "'" - router <- defaultHandler + router <- Room.newRoom name desc TCP.serveRPC router hostname (Room.port roomInvite) mainNet me parser :: Options.Parser Command diff --git a/src/Ssb/Peer/RPC/Room.hs b/src/Ssb/Peer/RPC/Room.hs index 0b85414..62dd6dc 100644 --- a/src/Ssb/Peer/RPC/Room.hs +++ b/src/Ssb/Peer/RPC/Room.hs @@ -315,7 +315,9 @@ instance RPC.Handler Room where resp <- getCurrentTime RPC.writeStreamJSON stream resp - serve room endpoint@otherwise arg stream = (RPC.notFoundHandlerFunc endpoint) arg stream + -- HACK: return OK when endpoint not known to avoid disconnecting clients + serve room endpoint@otherwise arg stream = return . return () + --serve room endpoint@otherwise arg stream = (RPC.notFoundHandlerFunc endpoint) arg stream notifyConnect _ _ = return . return $ () |