Blocking of multiple writers using the same event_system
Hans Ole Rafaelsen <[email protected]> Tue, 19 Feb 2008 09:04:18 -0800 (PST)
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi!
I have an application that have 3 Uq_engines.multiplex_controllers sharing
the same Unixqueue.event_system. One controller is reading from a socket
and forwarding the packets using the two other controllers that writes to
their sockets. All are TCP connections.
Stream
Stream |---------------> Sink_1
Source -----------> Application
|---------------> Sink_2
Stream
The controllers run independently of each other. That is, the reader will
read the next packet, start the two writers and request for a new packet,
not waiting for the writers to finish. In order to prevent the writers from
being overrun, their state is checked before each write, and if they are
still writing, then the packet will be queue in the application until the
writer finishes writing.
The problem is that if I block (stop reading, but maintaining the
connection) one of the receiver (sink_1) of the streams from the
application, the other out stream also get blocked. From the receiving
application (sink_2) it looks like it happens instantly, even though it goes
some time before the other writer also start complaining that it is in
write_state. The application is still receiving packets from the source. If
sink_1 start reading packets again, the application "recovers" to it's
normal state and continues processing packets.
Is this expected behavior? In the documentation it says that there can only
be one active writing on a multiplex_controller, but it states no limitation
on the number of active writers for the event_system. Does the limitation
also apply to the event_system? If so, what is the best suggestion for a
workaround?
Thanks,
Hans Ole
--
View this message in context: http://www.nabble.com/Blocking-of-multiple-writers-using-the-same-event_system-tp15561393p15561393.html
Sent from the OCamlNet mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/