#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;