Skip to content
Snippets Groups Projects
Verified Commit fb773dae authored by Camil Staps's avatar Camil Staps
Browse files

Update TCPIP/ObjectIO for strict maybes in TCPIP library

parent 0987b0f8
No related branches found
No related tags found
1 merge request!11Use strict maybe types in TCPIP library
implementation module osevent
import StdBool, StdList, StdMisc, StdTuple
import StdBool, StdList, StdMaybe, StdMisc, StdTuple
import clCrossCall_12, ostime, ostoolbox, ostypes
from commondef import hdtl, fatalError
from StdMaybe import :: Maybe(..)
......
implementation module osevent
import StdInt, StdBool, StdList, StdTuple
import StdInt, StdBool, StdList, StdMaybe, StdTuple
import events, desk, pointer
import StdClass, StdMisc
import code from "cTCP."
......
......@@ -81,11 +81,11 @@ instance Receivers TCP_ListenerReceiver where
= open_RChan_or_Listener close_listener ls id rAttributes endpointRef 0 (handleConnectRequest f) ListenerReceiver pSt
where
handleConnectRequest f (IE_CONNECTREQUEST,endpointRef,_) (ls,ps=:{io})
# (_, mbHostDuplexChan,_,io) = receive_MT (Just 0) (pack_tcplistener endpointRef) io
# (_, mbHostDuplexChan,_,io) = receive_MT (?Just 0) (pack_tcplistener endpointRef) io
= case mbHostDuplexChan of
Nothing
?None
-> (ls, {ps & io=io})
Just hostDuplexChan
?Just hostDuplexChan
-> f (Received hostDuplexChan) (ls, {ps & io=io})
getReceiverType _
......@@ -178,7 +178,7 @@ where
handleReceiveEvent :: !Id !Int ((ReceiveMsg ByteSeq) -> *(.ls, PSt .a) -> *(.ls, PSt .a)) (!InetEvent, !EndpointRef, !Int) *(.ls, PSt .a) -> *(.ls, PSt .a)
handleReceiveEvent _ maxSize f (IE_RECEIVED,endpointRef,_) (ls,ps=:{io})
# (_,mbTCPData,_,io) = receive_MT (Just 0) (pack_tcprchan (endpointRef,maxSize)) io
# (_,mbTCPData,_,io) = receive_MT (?Just 0) (pack_tcprchan (endpointRef,maxSize)) io
| isNothing mbTCPData
= (ls,{ps & io=io})
= f (Received (fromJust mbTCPData)) (ls,{ps & io=io})
......
......@@ -48,7 +48,7 @@ instance SelectReceive Void
accRChannels _ void
= ([],void)
getRState _ void env
= (Nothing, void, env)
= (?None, void, env)
instance getNrOfChannels (:^: *x *y) | getNrOfChannels x & getNrOfChannels y
where
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment