[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [MirageOS-devel] problem with NET=socket and multiple connections?
On Fri, Oct 24, 2014 at 3:09 PM, Len Maxwell <len@xxxxxxxx> wrote: > Hello, > > I am seeing some unexpected behavior with --unix and NET=socket on > Linux: it looks like the TCP server is not dealing well with multiple > connections. > Looking at the code in mirage-tcpip/unix/tcpip_stack_socket.ml, the listener loop does not accept the next connection until the previous client callback has completed. This did not look right to me, so I tried the following: --- a/unix/tcpip_stack_socket.ml +++ b/unix/tcpip_stack_socket.ml @@ -106,9 +106,12 @@ module Make(Console:V1_LWT.CONSOLE) = struct if true then loop () else return_unit in Lwt_unix.accept fd >>= fun (afd, _) -> - Lwt.catch - (fun () -> callback afd) - (fun _ -> return_unit) + Lwt.async (fun () -> + Lwt.catch + (fun () -> callback afd) + (fun _ -> return_unit) + ); + return_unit >>= fun () -> continue (); With this change, the client callback is handled in an async "thread", while the listener immediately loops back to accept the next connection. My issues with mirage-skeleton/stackv4 and mirage-www (on unix/socket) seem to be resolved. However, I'm new to OCaml/Lwt/Mirage, and not too confident this is the right fix. I'd appreciate any input. thanks -- Len _______________________________________________ MirageOS-devel mailing list MirageOS-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |