\r
\r
while ( (opt = getopt(argc, argv, "w")) != -1 ) \r
- {\r
+ {\r
switch(opt) \r
- {\r
+ {\r
case 'w':\r
wait = 1;\r
break;\r
uint8_t check_serverTick(void)\r
{\r
last = shmptr->alive;\r
- sleep( 1 ); // Sleep for 1 sec\r
- return(shmptr->alive - last); \r
+ sleep( 1 ); // Sleep for 1 sec\r
+ return(shmptr->alive - last); \r
}\r
\r
void run_shm(void)\r
\r
int cc;\r
\r
- printf( "\033[2J\033[H" ); //clear screen VT100\r
+ printf( "\033[2J\033[H" ); //clear screen VT100\r
\r
\r
- for( cc = 0 ; cc < shmptr->server_max_clients ; cc++ )\r
+ for( cc = 0 ; cc < shmptr->server_max_clients ; cc++ )\r
{\r
\r
if( !shmptr->client[cc].authenticated )\r
continue; \r
\r
- printf( "%s@%s:%i in channel: %s\n\\r
- \tOnline(secs): %lu Idle(secs): %lu\n\\r
- \tusingUDP=%i\n\\r
- \tdeaf=%i, mute=%i\n\\r
- \tself_deaf=%i, self_mute=%i\n\\r
- \trecording=%i\n\\r
- \tbOpus=%i\n\\r
- \tUDP_Avg/Var: %3.2f/%3.2f \n\\r
- \tTCP_Avg/Var: %3.2f/%3.2f \n\\r
- \tUDP_C/TCP_C: %lu/%lu\n", \r
- shmptr->client[cc].username,\r
- shmptr->client[cc].ipaddress,\r
- shmptr->client[cc].udp_port,\r
- shmptr->client[cc].channel,\r
- shmptr->client[cc].online_secs,\r
- shmptr->client[cc].idle_secs,\r
+ printf( "%s@%s:%i in channel: %s\n\\r
+ \tclient_OS: %s %s\n\\r
+ \tclient_info: %s\n\\r
+ \tavailableBandwidth: %i\n\\r
+ \tOnline(secs): %lu Idle(secs): %lu\n\\r
+ \tusingUDP=%i\n\\r
+ \tdeaf=%i, mute=%i\n\\r
+ \tself_deaf=%i, self_mute=%i\n\\r
+ \trecording=%i\n\\r
+ \tbOpus=%i\n\\r
+ \tisAdmin=%i\n\\r
+ \tisSuppressed=%i\n\\r
+ \tUDP_Avg/Var: %3.2f/%3.2f\n\\r
+ \tTCP_Avg/Var: %3.2f/%3.2f\n\\r
+ \tUDP_C/TCP_C: %lu/%lu\n", \r
+ shmptr->client[cc].username,\r
+ shmptr->client[cc].ipaddress,\r
+ shmptr->client[cc].udp_port,\r
+ shmptr->client[cc].channel,\r
+ shmptr->client[cc].os,\r
+ shmptr->client[cc].os_version,\r
+ shmptr->client[cc].release,\r
+ shmptr->client[cc].availableBandwidth,\r
+ shmptr->client[cc].online_secs,\r
+ shmptr->client[cc].idle_secs,\r
\r
- shmptr->client[cc].bUDP,\r
- shmptr->client[cc].deaf,\r
- shmptr->client[cc].mute,\r
- shmptr->client[cc].self_deaf,\r
- shmptr->client[cc].self_mute,\r
- shmptr->client[cc].recording,\r
- shmptr->client[cc].bOpus,\r
+ shmptr->client[cc].bUDP,\r
+ shmptr->client[cc].deaf,\r
+ shmptr->client[cc].mute,\r
+ shmptr->client[cc].self_deaf,\r
+ shmptr->client[cc].self_mute,\r
+ shmptr->client[cc].recording,\r
+ shmptr->client[cc].bOpus,\r
+ \r
+ shmptr->client[cc].isAdmin,\r
+ shmptr->client[cc].isSuppressed,\r
\r
- shmptr->client[cc].UDPPingAvg,\r
- shmptr->client[cc].UDPPingVar,\r
- shmptr->client[cc].TCPPingAvg,\r
- shmptr->client[cc].TCPPingVar,\r
- shmptr->client[cc].UDPPackets,\r
- shmptr->client[cc].TCPPackets ); fflush(stdout); // fflush need because of sleep() call\r
+ shmptr->client[cc].UDPPingAvg,\r
+ shmptr->client[cc].UDPPingVar,\r
+ shmptr->client[cc].TCPPingAvg,\r
+ shmptr->client[cc].TCPPingVar,\r
+ shmptr->client[cc].UDPPackets,\r
+ shmptr->client[cc].TCPPackets ); fflush(stdout); // fflush need because of sleep() call\r
}\r
- if( !check_serverTick() ) \r
+ if( !check_serverTick() )\r
{\r
- exit(EXIT_FAILURE); //You dont have to exit you could just report the fact that the data is not valid \r
- }\r
+ exit(EXIT_FAILURE); //You dont have to exit you could just report the fact that the data is not valid \r
+ }\r
}
\ No newline at end of file
void Sharedmemory_init(void) \r
{\r
\r
- int bindport = getIntConf(BINDPORT); //MJP BUG commandline option for address and port dont work this way going to have \r
+ int bindport = getIntConf(BINDPORT); //MJP BUG commandline option for address and port dont work this way going to have \r
int server_max_clients = getIntConf(MAX_CLIENTS); //to bring them across as prameters to Sharedmemory_init(void)\r
int shmptr_size = sizeof( shm_t ) + (sizeof( shmclient_t ) * server_max_clients);\r
\r
\r
\r
- sprintf( shm_file_name, "umurmurd:%i", bindport );\r
+ sprintf( shm_file_name, "umurmurd:%i", bindport );\r
\r
Log_info("SHM_FD: %s", shm_file_name );\r
\r
\r
shmptr = mmap(0, shmptr_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);\r
if (shmptr == (void *) -1) \r
- {\r
+ {\r
fprintf(stderr, "mmap failed : %s\n", strerror(errno)); //MJP BUG make this Log_ calls once I get this working\r
exit(1);\r
} \r
\r
\r
memset( shmptr, 0, shmptr_size );\r
- \r
+ \r
shmptr->umurmurd_pid = getpid();\r
shmptr->server_max_clients = server_max_clients; \r
}\r
uint64_t now;\r
unsigned int cc = 0;\r
client_t *client_itr = NULL;\r
- static size_t bt_end = sizeof( bool_t ) * 8, //compute once\r
- pa_end = sizeof( float ) * 4,\r
- pc_end = sizeof( uint32_t ) * 2;\r
- \r
- \r
+\r
memset( &shmptr->client[0], 0, sizeof( shmclient_t ) * shmptr->server_max_clients );\r
shmptr->clientcount = Client_count();\r
\r
\r
strncpy( shmptr->client[cc].username, client_itr->username, 120 );\r
strncpy( shmptr->client[cc].ipaddress, Util_clientAddressToString( client_itr ), 45 );\r
- shmptr->client[cc].tcp_port = Util_clientAddressToPortTCP( client_itr );\r
- shmptr->client[cc].udp_port = Util_clientAddressToPortUDP( client_itr );\r
strncpy( shmptr->client[cc].channel, channel->name, 120 );\r
+ \r
+ strncpy( shmptr->client[cc].os, client_itr->os, 120 );\r
+ strncpy( shmptr->client[cc].release, client_itr->release, 120 );\r
+ strncpy( shmptr->client[cc].os_version, client_itr->os_version, 120 );\r
+ \r
+ shmptr->client[cc].tcp_port = Util_clientAddressToPortTCP( client_itr );\r
+ shmptr->client[cc].udp_port = Util_clientAddressToPortUDP( client_itr ); \r
\r
shmptr->client[cc].online_secs = ( now - client_itr->connectTime ) / 1000000LL;\r
shmptr->client[cc].idle_secs = ( now - client_itr->idleTime ) / 1000000LL;\r
- \r
- memcpy( &shmptr->client[cc].bUDP, &client_itr->bUDP, bt_end );\r
- memcpy( &shmptr->client[cc].UDPPingAvg, &client_itr->UDPPingAvg, pa_end );\r
- memcpy( &shmptr->client[cc].UDPPackets, &client_itr->UDPPackets, pc_end );\r
+ \r
+ shmptr->client[cc].bUDP = client_itr->bUDP;\r
+ shmptr->client[cc].deaf = client_itr->deaf;\r
+ shmptr->client[cc].mute = client_itr->mute;\r
+ shmptr->client[cc].bOpus = client_itr->bOpus;\r
+ shmptr->client[cc].self_deaf = client_itr->self_deaf;\r
+ shmptr->client[cc].self_mute = client_itr->self_mute;\r
+ shmptr->client[cc].recording = client_itr->recording;\r
+ shmptr->client[cc].authenticated = client_itr->authenticated;\r
+ \r
+ shmptr->client[cc].availableBandwidth = client_itr->availableBandwidth;\r
+ \r
+ shmptr->client[cc].UDPPingAvg = client_itr->UDPPingAvg;\r
+ shmptr->client[cc].UDPPingVar = client_itr->UDPPingVar;\r
+ shmptr->client[cc].TCPPingAvg = client_itr->TCPPingAvg;\r
+ shmptr->client[cc].TCPPingVar = client_itr->TCPPingVar;\r
+ \r
+ shmptr->client[cc].isAdmin = client_itr->isAdmin;\r
+ shmptr->client[cc].isSuppressed = client_itr->isSuppressed;\r
+ \r
+ shmptr->client[cc].UDPPackets = client_itr->UDPPackets;\r
+ shmptr->client[cc].TCPPackets = client_itr->TCPPackets;\r
+ \r
} \r
cc++; \r
}\r