bridge: Add a prepare vfunc to CockpitChannel

The queueing of cockpit_channel_ready() and cockpit_channel_close()
was too magical and causing too much complexity.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge: When we receive clean close before ready, don't close yet

When we received data or a clean close before the channel is ready
don't close prematurely. Make sure all the data is drained, and
then do the clean close.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge: CockpitChannel "disconnected" when transport closes

The CockpitChannel closes unsuccessfully when the transport
closes. This lets implementations react immediately, even if the
transport closes without error.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge: More robust parsing of channel options

The parsing of channel options was quite haphazard, and didn't
detect bad types for values, etc. This is more verbose, but it's more
failure proof and produces better diagnostic messages.

Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>
bridge: Better diagnostics for file read/write failures

In the file read/replace channels, put some context in the messages
so we can have a clue as to what's causing it. Previously we had:

cockpit-bridge-Message: /tmp/.V3DRPX/foo: Bad file descriptor

Closes #1518
Reviewed-by: Marius Vollmer <marius.vollmer@redhat.com>