#include "poll-loop.h"
#include "random.h"
#include "util.h"
-
-#define THIS_MODULE VLM_stream
#include "vlog.h"
+VLOG_DEFINE_THIS_MODULE(stream)
+
/* State of an active stream.*/
enum stream_state {
SCS_CONNECTING, /* Underlying stream is not connected. */
fatal_signal_run();
- while (error == EAGAIN) {
- stream_run(stream);
- stream_run_wait(stream);
- stream_connect_wait(stream);
- poll_block();
- error = stream_connect(stream);
+ if (!error) {
+ while ((error = stream_connect(stream)) == EAGAIN) {
+ stream_run(stream);
+ stream_run_wait(stream);
+ stream_connect_wait(stream);
+ poll_block();
+ }
assert(error != EINPROGRESS);
}
+
if (error) {
stream_close(stream);
*streamp = NULL;
}
}
-/* Tries to complete the connection on 'stream', which must be an active
- * stream. If 'stream''s connection is complete, returns 0 if the connection
- * was successful or a positive errno value if it failed. If the
- * connection is still in progress, returns EAGAIN. */
+/* Tries to complete the connection on 'stream'. If 'stream''s connection is
+ * complete, returns 0 if the connection was successful or a positive errno
+ * value if it failed. If the connection is still in progress, returns
+ * EAGAIN. */
int
stream_connect(struct stream *stream)
{
void
stream_report_content(const void *data, size_t size,
enum stream_content_type expected_type,
- enum vlog_module module, const char *stream_name)
+ struct vlog_module *module, const char *stream_name)
{
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 5);
enum stream_content_type actual_type;