#define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35 || x == SWITCH_STATUS_INTR)
+
+#ifdef _MSC_VER
+
+#define switch_errno() WSAGetLastError()
+
+static inline int switch_errno_is_break(int errcode)
+{
+ return errcode == WSAEWOULDBLOCK || errcode == WSAEINPROGRESS || errcode == WSAEINTR;
+}
+
+#else
+
+#define switch_errno() errno
+
+static inline int switch_errno_is_break(int errcode)
+{
+ return errcode == EAGAIN || errcode == EWOULDBLOCK || errcode == EINPROGRESS || errcode == EINTR || errcode == ETIMEDOUT;
+}
+
+#endif
+
+
/*!
\brief Return a printable name of a switch_priority_t
\param priority the priority to get the name of
s = poll(pfds, 1, ms);
+ if (s < 0) {
+ if (switch_errno_is_break(switch_errno())) {
+ s = 0;
+ }
+ }
+
if (s < 0) {
r = s;
} else if (s > 0) {
s = poll(pfds, len, ms);
+ if (s < 0) {
+ if (switch_errno_is_break(switch_errno())) {
+ s = 0;
+ }
+ }
+
if (s < 0) {
r = s;
} else if (s > 0) {
s = select(sock + 1, (flags & SWITCH_POLL_READ) ? rfds : NULL, (flags & SWITCH_POLL_WRITE) ? wfds : NULL, (flags & SWITCH_POLL_ERROR) ? efds : NULL, &tv);
+ if (s < 0) {
+ if (switch_errno_is_break(switch_errno())) {
+ s = 0;
+ }
+ }
+
if (s < 0) {
r = s;
} else if (s > 0) {
s = select(max_fd + 1, (flags & SWITCH_POLL_READ) ? rfds : NULL, (flags & SWITCH_POLL_WRITE) ? wfds : NULL, (flags & SWITCH_POLL_ERROR) ? efds : NULL, &tv);
+ if (s < 0) {
+ if (switch_errno_is_break(switch_errno())) {
+ s = 0;
+ }
+ }
+
if (s < 0) {
r = s;
} else if (s > 0) {