iproto: use iostream abstraction
Instead of writing to the socket fd directly using sio, we wrap it in iostream. This will allow us to use complex communication protocols in iproto. One thing that should be noted about this patch is how we handle ev_io_start when we need to wait for the socket to become readable or writable. Since iostream_write can block because it wants to read from the socket and iostream_read can block because it wants to write to the socket, we might need to update input/output events before ev_io_start. Since ev_io events can't be updated while ev_io is active, we need to stop ev_io for this.
Loading