switch_assert(listener != NULL);
+#if MOD_SKINNY_NONBLOCK
switch_socket_opt_set(listener->sock, SWITCH_SO_TCP_NODELAY, TRUE);
switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
-
+#else
+ switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, FALSE);
+ switch_socket_timeout_set(listener->sock, 5000000);
+#endif
if (listener->profile->debug > 0) {
if (zstr(listener->remote_ip)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open\n");
}
}
- switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
switch_set_flag_locked(listener, LFLAG_RUNNING);
keepalive_listener(listener, NULL);
add_listener(listener);
if (status != SWITCH_STATUS_SUCCESS) {
switch(status) {
- case SWITCH_STATUS_BREAK:
- break;
case SWITCH_STATUS_TIMEOUT:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Communication Time Out with %s:%d.\n",
listener->remote_ip, listener->remote_port);
return SWITCH_STATUS_MEMERR;
}
- if (!listener_is_ready(listener)) {
- return SWITCH_STATUS_BREAK;
- }
-
ptr = mbuf;
while (listener_is_ready(listener)) {
status = switch_socket_recv(listener->sock, ptr, &mlen);
if (!listener_is_ready(listener)) {
- return SWITCH_STATUS_BREAK;
+ break;
}
- if (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket break.\n");
+ if ((status != 70007 /* APR_TIMEUP */) && !SWITCH_STATUS_IS_BREAK(status) && (status != SWITCH_STATUS_SUCCESS)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket break with status=%d.\n", status);
return SWITCH_STATUS_FALSE;
}