From: Mart Lubbers Date: Mon, 27 Feb 2017 16:20:47 +0000 (+0100) Subject: remove tcp busy loop X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=03f652f7afb24678d565d1b12f12b0fa27444dd2;p=mTask.git remove tcp busy loop --- diff --git a/Devices/mTaskTCP.icl b/Devices/mTaskTCP.icl index e0b85e2..dfa7f2f 100644 --- a/Devices/mTaskTCP.icl +++ b/Devices/mTaskTCP.icl @@ -24,9 +24,9 @@ instance MTaskDuplex TCPSettings where onConnect _ (msgs,send,sendStopped) = (Ok "", Just (msgs,[],sendStopped), map encode send, False) whileConnected :: (Maybe String) String ([MTaskMSGRecv], [MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool), [String], Bool) - whileConnected mnewData acc (msgs,send,sendStopped) - | not (trace_tn (printToString (map decode (maybeToList mnewData)))) = undef - = (Ok acc, Just (msgs ++ map decode (maybeToList mnewData),[],sendStopped), map encode send, False) + whileConnected Nothing _ (_,[],_) = (Ok "", Nothing, [], False) + whileConnected md _ (msgs,send,sendStopped) + = (Ok "", Just (msgs++map decode (maybeToList md),[],sendStopped), map encode send, False) onDisconnect :: String ([MTaskMSGRecv],[MTaskMSGSend],Bool) -> (MaybeErrorString String, Maybe ([MTaskMSGRecv],[MTaskMSGSend],Bool)) - onDisconnect l (msgs,send,sendStopped) = (Ok l, Nothing) + onDisconnect _ (msgs,send,sendStopped) = (Ok "", Nothing) diff --git a/client/main.c b/client/main.c index 337834f..9fc91df 100644 --- a/client/main.c +++ b/client/main.c @@ -84,11 +84,11 @@ void loop(void) curtask->lastrun = cyclestart; if(curtask->interval == 0){ curtask->used = false; - write_byte('m'); - write_byte('d'); - write_byte('\n'); +// write_byte('m'); +// write_byte('d'); +// write_byte('\n'); } - write_byte('\n'); +// write_byte('\n'); } }