diff options
-rwxr-xr-x | snowcast_control | bin | 35357 -> 35357 bytes | |||
-rwxr-xr-x | snowcast_listener | bin | 34654 -> 34654 bytes | |||
-rwxr-xr-x | snowcast_server | bin | 55852 -> 55852 bytes | |||
-rw-r--r-- | snowcast_server.dSYM/Contents/Resources/DWARF/snowcast_server | bin | 25692 -> 25447 bytes | |||
-rw-r--r-- | snowcast_server_concurrent.c | 37 |
5 files changed, 19 insertions, 18 deletions
diff --git a/snowcast_control b/snowcast_control Binary files differindex 38831a0..656ec0f 100755 --- a/snowcast_control +++ b/snowcast_control diff --git a/snowcast_listener b/snowcast_listener Binary files differindex fe63fce..8d29cf9 100755 --- a/snowcast_listener +++ b/snowcast_listener diff --git a/snowcast_server b/snowcast_server Binary files differindex fba1c8b..8ff138a 100755 --- a/snowcast_server +++ b/snowcast_server diff --git a/snowcast_server.dSYM/Contents/Resources/DWARF/snowcast_server b/snowcast_server.dSYM/Contents/Resources/DWARF/snowcast_server Binary files differindex d562204..b91915d 100644 --- a/snowcast_server.dSYM/Contents/Resources/DWARF/snowcast_server +++ b/snowcast_server.dSYM/Contents/Resources/DWARF/snowcast_server diff --git a/snowcast_server_concurrent.c b/snowcast_server_concurrent.c index 5a4ff9f..92b2dee 100644 --- a/snowcast_server_concurrent.c +++ b/snowcast_server_concurrent.c @@ -86,15 +86,15 @@ int main(int argc, char *argv[]) port = argv[1]; num_stations = argc - 2; - printf("port: %s\n", port); - printf("num_stations: %d\n", num_stations); + // printf("port: %s\n", port); + // printf("num_stations: %d\n", num_stations); // init stations size_t totalSize = 0; // get size to malloc for (int i = 2; i < argc; i++) { - printf("file: %s\n", argv[i]); + // printf("file: %s\n", argv[i]); totalSize += sizeof(int) + strlen(argv[i]); } station_data = malloc(totalSize); @@ -105,10 +105,10 @@ int main(int argc, char *argv[]) } // print all indexes in station data - for (int i = 0; i < num_stations; i++) - { - printf("station %d: %s\n", i, station_data[i].filePath); - } + // for (int i = 0; i < num_stations; i++) + // { + // printf("station %d: %s\n", i, station_data[i].filePath); + // } // make array of user data user_data = malloc(sizeof(user_t) * max_active_users); @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) } else { print_fd = STDOUT_FILENO; } - printf("print_fd: %d\n", print_fd); + // printf("print_fd: %d\n", print_fd); pthread_t print_info_thread; pthread_create(&print_info_thread, NULL, print_info_routine, print_fd); // note - this file descriptor is closed in the thread @@ -249,9 +249,9 @@ int sendall(int udp_sockfd, char *buf, int *len, struct addrinfo *thread_res) void *send_udp_packet_routine(void *arg) { // unpack args int user_index = (int) arg; - printf("thread : user_index: %d\n", user_index); + // printf("thread : user_index: %d\n", user_index); // print user data - print_user_data(user_index); + // print_user_data(user_index); // declare vairables to be used int did_work = 1; @@ -402,21 +402,22 @@ void *synchronization_thread(void *arg) { if (station_data[i].seekIndex >= size) { station_data[i].seekIndex = 0; - + // printf("resetting station %d\n", i); // send the announce messages - for (int i = 0; i < max_active_users; i++) + for (int j = 0; j < max_active_users; i++) { // if (user_data[i].streamThread == NULL) { // break; // } - if (user_data[i].sockfd == -1) + if (user_data[j].sockfd == -1) continue; // print_user_data(i); // update the station of each user - if (user_data[i].stationNum == i) + if (user_data[j].stationNum == i) { - send_announce_reply(user_data[i].sockfd, i); + // printf("sending announce to user %d\n", i); + send_announce_reply(user_data[j].sockfd, i); } } } @@ -579,7 +580,7 @@ void *select_thread(void *arg) { } int station_num = ntohs(command.number); - printf("station_num: %d\n", station_num); + // printf("station_num: %d\n", station_num); if (station_num >= num_stations || station_num < 0) { // send back in invalid command char * message = "Station number out of range."; @@ -700,13 +701,13 @@ void send_announce_reply(int fd, int station_num) { memcpy(send_buffer + 2, file_path, len_file_path); - printf("buffer: %s\n", send_buffer); + // printf("buffer: %s\n", send_buffer); int bytessent; if ((bytessent = send(fd, send_buffer, len_file_path + 2, 0)) == -1) perror("send"); // print the number of bytes sent - printf("sent %d bytes\n", bytessent); + // printf("sent %d bytes\n", bytessent); free(send_buffer); } |