Skip to content

Conversation

@prernadabi23
Copy link

Updated the file to use Lwt_stream.t in place of using Lwt_async+Lwt_mvar.t

fixes: #4
Signed-off-by: Prerna Dabi [email protected]
@rand00

Copy link
Owner

@rand00 rand00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are closer to the solution than before, but a bunch of more changes are required. Try to see how much you can solve from my comments and from the compiler complaining.

.. (will be okay if not ordered, as Ring reorders)
*)
Lwt.async (fun () -> Lwt_mvar.put flow.sink ring_field);
Lwt_stream.push flow.sink ring_field;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such function. This is why I've said that the type alias type 'a stream = 'a Lwt_stream.t * ('a option -> unit) on line 164 is the type needed for the sink field.

)
end;
Lwt_mvar.take flow.sink >>= fun ring_field ->
Lwt_stream.get_available flow.sink >>= fun ring_field ->
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function returns an 'a list and not a 'a Lwt.t which is what I would use here. This is also what is needed to use the bind operator >>=. See if you can find the correct function to use here

type partial_flow = {
is_client : bool;
sink : ring_field Lwt_mvar.t;
sink : ring_field Lwt_stream.t;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my later comment concerning push, you are almost using the correct type, but not quite.

@prernadabi23
Copy link
Author

You are closer to the solution than before

😭 Thank you..!!
Thank you for the suggestions, I am working on them.

@prernadabi23
Copy link
Author

Hello @rand00, I will be a little late as I have exams this month, but I am working on it whenever I am free.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Instead of using Lwt.async + Lwt_mvar when receiving UDP datagram, use an Lwt_stream.t

2 participants