Commit 7fec2334 authored by Mart Lubbers's avatar Mart Lubbers

patch more onDestroy handlers

parent e0633e14
Pipeline #20459 passed with stage
in 4 minutes and 48 seconds
......@@ -212,7 +212,7 @@ where
syncNetworkChannel :: String Int String (String -> m) (m -> String) (Shared sds ([m],Bool,[m],Bool)) -> Task () | iTask m & RWShared sds
syncNetworkChannel server port msgSeparator decodeFun encodeFun channel
= tcpconnect server port channel {ConnectionHandlers|onConnect=onConnect,onData=onData,onShareChange=onShareChange,onDisconnect=onDisconnect} @! ()
= tcpconnect server port channel {ConnectionHandlers|onConnect=onConnect,onData=onData,onShareChange=onShareChange,onDisconnect=onDisconnect,onDestroy= \s->(Ok s, [])} @! ()
where
onConnect _ _ (received,receiveStopped,send,sendStopped)
= (Ok "",if (not (isEmpty send)) (Just (received,False,[],sendStopped)) Nothing, map encodeFun send,False)
......
......@@ -15,6 +15,7 @@ deviceRequest request close
, onData = onData
, onShareChange = onShareChange
, onDisconnect = onDisconnect
, onDestroy= \s->(Ok s, [])
}
>>= \{DeviceRequestState|result} -> return result
where
......
......@@ -38,6 +38,7 @@ authServer port = tcplisten port True authServerShare {ConnectionHandlers
, onData = onData
, onShareChange = onShareChange
, onDisconnect = onDisconnect
, onDestroy = \s->(Ok s, [])
} -|| (process authServerShare) @! ()
where
onConnect :: ConnectionId String AuthShare -> (MaybeErrorString AuthServerState, Maybe AuthShare, [String], Bool)
......@@ -134,6 +135,7 @@ where
, onData = onData
, onShareChange = onShareChange
, onDisconnect = onDisconnect
, onDestroy = \s->(Ok s, [])
}) @? taskResult)
>>- \(resps,_) -> case resps of
[resp:_] -> return (fromJSON (fromString (base64Decode resp)))
......
......@@ -4,7 +4,7 @@ import Text
sendEmail :: ![EmailOpt] !String !String !String !String -> Task ()
sendEmail opts subject body sender recipient
= tcpconnect server port (constShare ()) {ConnectionHandlers|onConnect=onConnect,whileConnected=whileConnected,onDisconnect=onDisconnect}
= tcpconnect server port (constShare ()) {ConnectionHandlers|onConnect=onConnect,whileConnected=whileConnected,onDisconnect=onDisconnect,onDestroy= \s->(Ok s, [])}
@! ()
where
server = getServerOpt opts
......
......@@ -62,7 +62,7 @@ serveWebService port handler
where
manageConnections io
= tcplisten port False (currentTimespec |*< io)
{ConnectionHandlers|onConnect=onConnect,onData=onData,onShareChange=onShareChange,onDisconnect=onDisconnect}
{ConnectionHandlers|onConnect=onConnect,onData=onData,onShareChange=onShareChange,onDisconnect=onDisconnect,onDestroy= \s->(Ok s, [])}
onConnect connId client_name (now,io)
= (Ok (Idle client_name now), Nothing, [], False)
......@@ -185,7 +185,7 @@ where
callHTTP :: !HTTPMethod !URI !String !(HTTPResponse -> (MaybeErrorString a)) -> Task a | iTask a
callHTTP method url=:{URI|uriScheme,uriRegName=Just uriRegName,uriPort,uriPath,uriQuery,uriFragment} data parseFun
= tcpconnect uriRegName port (constShare ()) {ConnectionHandlers|onConnect=onConnect,onData=onData,onShareChange=onShareChange,onDisconnect=onDisconnect}
= tcpconnect uriRegName port (constShare ()) {ConnectionHandlers|onConnect=onConnect,onData=onData,onShareChange=onShareChange,onDisconnect=onDisconnect,onDestroy= \s->(Ok s, [])}
@? taskResult
where
port = fromMaybe 80 uriPort
......
......@@ -88,6 +88,7 @@ instanceServer port domain = tcplisten port True instanceServerShared {Connectio
, onData = onData
, onShareChange = onShareChange
, onDisconnect = onDisconnect
, onDestroy= \s->(Ok s, [])
} -|| (instanceClient` "127.0.0.1" port domain True) -|| (process instanceServerShared) @! ()
where
onConnect :: ConnectionId String InstanceServerShare -> (MaybeErrorString InstanceServerState, Maybe InstanceServerShare, [String], Bool)
......@@ -472,6 +473,7 @@ where
, onData = onData
, onShareChange = onShareChange
, onDisconnect = onDisconnect
, onDestroy = \s->(Ok s, [])
} @! Nothing)
-||- (viewInformation () [] () >>* [OnAction (Action "reset") (always (return Nothing))])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment