int Dht_Process(void *client_) { Client *client = (Client *)client_; check(client != NULL, "NULL client pointer"); int rc = Client_HandleSearches(client); check(rc == 0, "Client_HandleSearches failed"); Client_CleanSearches(client); rc = Client_Send(client, client->queries); check(rc == 0, "Client_Send failed"); rc = Client_Receive(client); check(rc == 0, "Client_Receive failed"); rc = Client_HandleMessages(client); check(rc == 0, "Client_Handle failed"); rc = Client_Send(client, client->replies); check(rc == 0, "Client_Send failed"); return 0; error: return -1; }
void send_motd(Client* client) { char motd[1024]; memset(motd, 0, 1024); strcpy(motd, "====== MOTD ======\n" "Welcome to the notice boards!\n" "Enjoy your stay! :-)\n\n" "You will automatically disconnect after 30 minutes of inactivity.\n" "==================\n"); Client_Send(*client, motd, 1024); }