Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main (int argc, char* argv[]) {
- FILE* cityfile;
- FILE* edgefile;
- int ret = EXIT_FAILURE;
- if (argc != 3) return ret;
- ec_meno1( signal_block_all() );
- ec_null( cityfile = fopen(argv[1], "r") );
- ec_null( edgefile = fopen(argv[2], "r") );
- ec_null( map = load_graph(cityfile, edgefile) );
- ec_null( logfile = fopen(LOGFILE, "w") );
- ec_meno1( server_sock = createServerChannel(SOCKNAME) );
- /*ec_null( authlist = authlist_new() );*/
- ec_null( offers = offerlist_new() );
- ec_null( requests = requestlist_new() );
- ec_null( sessions = sessionlist_new() );
- login_init();
- ec_nzero( pthread_create(&request_dispatcher, NULL, dispatcher, NULL) );
- ec_nzero( pthread_create(&request_match, NULL, match, logfile) );
- ec_nzero( pthread_join(request_match, NULL) );
- printf("Match terminated...\n");
- ec_nzero( pthread_join(request_dispatcher, NULL) );
- printf("Dispatcher terminated...\n");
- ret = EXIT_SUCCESS;
- sessionlist_print(sessions);
- requestlist_print(requests);
- offerlist_print(offers);
- /* Apertura del socket, inizio server */
- /* return 0;*/
- EC_CLEANUP_BGN
- sessionlist_free(&sessions);
- requestlist_free(&requests);
- offerlist_free(&offers);
- /* authlist_free(&authlist);*/
- closeSocket(server_sock);
- printf("Unlinking\n");
- unlink(SOCKNAME);
- free_graph(&map);
- if (logfile != NULL) fclose(logfile);
- if (cityfile != NULL) fclose(cityfile);
- if (edgefile != NULL) fclose(edgefile);
- return ret;
- EC_CLEANUP_END
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement