sigset_t pselect_sigset;
-
int usleep_uncancellable(useconds_t usec) {
- int response;
- int oldState;
+ int response;
+ int oldState;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState);
response = usleep_uncancellable(usec);
pthread_setcancelstate(oldState, NULL);
static uint16_t UDPPortIndex = 0;
void resetFreeUDPPort() {
- debug(1,"Resetting UDP Port Suggestion to %u",config.udp_port_base);
- UDPPortIndex = 0;
+ debug(1, "Resetting UDP Port Suggestion to %u", config.udp_port_base);
+ UDPPortIndex = 0;
}
uint16_t nextFreeUDPPort() {
}
void rtp_audio_receiver_cleanup_handler(void *arg) {
- int oldState;
+ int oldState;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState);
debug(3, "Audio Receiver Cleanup.");
rtsp_conn_info *conn = (rtsp_conn_info *)arg;
}
void rtp_timing_receiver_cleanup_handler(void *arg) {
- int oldState;
+ int oldState;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldState);
debug(3, "Timing Receiver Cleanup.");
rtsp_conn_info *conn = (rtsp_conn_info *)arg;
debug(3, "Cancel Timing Requester.");
pthread_cancel(conn->timer_requester);
- debug(3, "Join Timing Requester.");
+ debug(3, "Join Timing Requester.");
pthread_join(conn->timer_requester, NULL);
debug(3, "Close Timing Socket.");
close(conn->timing_socket);
int local_socket = socket(ip_family, SOCK_DGRAM, IPPROTO_UDP);
if (local_socket == -1)
die("Could not allocate a socket.");
-
+
int val = 1;
ret = setsockopt(local_socket, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
if (ret < 0) {
char errorstring[1024];
strerror_r(errno, (char *)errorstring, sizeof(errorstring));
- debug(1,"Error %d: \"%s\". Couldn't set SO_REUSEADDR");
+ debug(1, "Error %d: \"%s\". Couldn't set SO_REUSEADDR");
}
-
SOCKADDR myaddr;
int tryCount = 0;
uint16_t desired_port;
if (errno == EINTR)
continue;
if (errno != ECONNRESET) {
- char errorstring[1024];
- strerror_r(errno, (char *)errorstring, sizeof(errorstring));
- debug(1, "Connection %d: rtsp_read_request_response_read_error %d: \"%s\".",
- conn->connection_number, errno, (char *)errorstring);
+ char errorstring[1024];
+ strerror_r(errno, (char *)errorstring, sizeof(errorstring));
+ debug(1, "Connection %d: rtsp_read_request_response_read_error %d: \"%s\".",
+ conn->connection_number, errno, (char *)errorstring);
}
reply = rtsp_read_request_response_read_error;
goto shutdown;
"timing_port=%d;server_"
"port=%d",
conn->local_control_port, conn->local_timing_port, conn->local_audio_port);
-
msg_add_header(resp, "Transport", resphdr);
msg_add_header(resp, "Session", "1");
resp->respcode = 200;
- debug(1, "Connection %d: SETUP with UDP ports Control: %d, Timing: %d and Audio: %d.", conn->connection_number, conn->local_control_port, conn->local_timing_port, conn->local_audio_port);
+ debug(1, "Connection %d: SETUP with UDP ports Control: %d, Timing: %d and Audio: %d.",
+ conn->connection_number, conn->local_control_port, conn->local_timing_port,
+ conn->local_audio_port);
return;
error:
if (rc)
debug(1, "Connection %d: error %d destroying flush_mutex.", conn->connection_number, rc);
-
debug(2, "Cancel watchdog thread.");
pthread_cancel(conn->player_watchdog_thread);
int oldState;
debug(2, "Delete watchdog mutex.");
pthread_mutex_destroy(&conn->watchdog_mutex);
-
debug(3, "Connection %d: Checking play lock.", conn->connection_number);
debug_mutex_lock(&playing_conn_lock, 1000000, 3); // get it
if (playing_conn == conn) {
playing_conn = NULL;
}
debug_mutex_unlock(&playing_conn_lock, 3);
-
+
debug(2, "Connection %d: RTSP thread terminated.", conn->connection_number);
conn->running = 0;
}