Clang formatted.

This commit is contained in:
Mike Brady
2018-11-29 12:18:07 +00:00
parent c318796e55
commit ca45d2ecbe
4 changed files with 18 additions and 21 deletions
+4 -5
View File
@@ -94,10 +94,9 @@ volatile int debuglev = 0;
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);
@@ -107,8 +106,8 @@ int usleep_uncancellable(useconds_t usec) {
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() {
+1 -1
View File
@@ -330,7 +330,7 @@ char *get_version_string(); // mallocs a string space -- remember to free it aft
void sps_nanosleep(const time_t sec,
const long nanosec); // waits for this time, even through interruptions
int usleep_uncancellable(useconds_t usec);
#endif // _COMMON_H
+5 -6
View File
@@ -98,7 +98,7 @@ uint64_t local_to_remote_time_difference_now(rtsp_conn_info *conn) {
}
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;
@@ -564,13 +564,13 @@ void *rtp_timing_sender(void *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);
@@ -867,16 +867,15 @@ static uint16_t bind_port(int ip_family, const char *self_ip_address, uint32_t s
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;
+8 -9
View File
@@ -571,10 +571,10 @@ enum rtsp_read_request_response rtsp_read_request(rtsp_conn_info *conn, rtsp_mes
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;
@@ -924,14 +924,15 @@ void handle_setup(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
"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:
@@ -2065,7 +2066,6 @@ void rtsp_conversation_thread_cleanup_function(void *arg) {
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;
@@ -2076,7 +2076,6 @@ void rtsp_conversation_thread_cleanup_function(void *arg) {
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) {
@@ -2084,7 +2083,7 @@ void rtsp_conversation_thread_cleanup_function(void *arg) {
playing_conn = NULL;
}
debug_mutex_unlock(&playing_conn_lock, 3);
debug(2, "Connection %d: RTSP thread terminated.", conn->connection_number);
conn->running = 0;
}