+ while(!connected || utcp_is_active(u)) {
+ size_t max = c ? utcp_get_sndbuf_free(c) : 0;
+ if(max > sizeof buf)
+ max = sizeof buf;
+
+ int timeout_ms = timeout.tv_sec * 1000 + timeout.tv_usec / 1000 + 1;
+
+ debug("polling, dir = %d, timeout = %d\n", dir, timeout_ms);
+ if((dir & DIR_READ) && max)
+ poll(fds, 2, timeout_ms);
+ else
+ poll(fds + 1, 1, timeout_ms);