shm_t *shmptr = NULL;\r
char shm_file_name[128];\r
\r
-void Sharedmemory_init( int bindport, int bindport6 ) \r
+void Sharedmemory_init( int bindport, int bindport6 )\r
{\r
- \r
- int server_max_clients = getIntConf(MAX_CLIENTS); \r
+\r
+ int server_max_clients = getIntConf(MAX_CLIENTS);\r
int shmtotal_size = sizeof( shm_t ) + (sizeof( shmclient_t ) * server_max_clients);\r
\r
if( !bindport )\r
{\r
- bindport = getIntConf(BINDPORT); \r
+ bindport = getIntConf(BINDPORT);\r
}\r
\r
sprintf( shm_file_name, "/umurmurd:%i", bindport );\r
{\r
Log_fatal( "SHM_API: Open failed:%s\n", strerror(errno));\r
exit(EXIT_FAILURE);\r
- } \r
+ }\r
\r
if( ftruncate( shm_fd, shmtotal_size ) == -1 )\r
{\r
- Log_fatal( "SHM_API: ftruncate : %s\n", strerror(errno)); \r
+ Log_fatal( "SHM_API: ftruncate : %s\n", strerror(errno));\r
exit(EXIT_FAILURE);\r
}\r
\r
shmptr = mmap( 0, shmtotal_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0 );\r
- if (shmptr == MAP_FAILED) \r
+ if (shmptr == MAP_FAILED)\r
{\r
Log_fatal( "SHM_API: mmap failed : %s\n", strerror(errno));\r
exit(EXIT_FAILURE);\r
- } \r
+ }\r
\r
memset( shmptr, 0, shmtotal_size );\r
\r
shmptr->umurmurd_pid = getpid();\r
- shmptr->server_max_clients = server_max_clients; \r
+ shmptr->server_max_clients = server_max_clients;\r
shmptr->shmtotal_size = shmtotal_size;\r
- shmptr->shmclient_size = sizeof( shmclient_t ) * shmptr->server_max_clients; \r
- \r
+ shmptr->shmclient_size = sizeof( shmclient_t ) * shmptr->server_max_clients;\r
+\r
}\r
\r
-void Sharedmemory_update(void) \r
+void Sharedmemory_update(void)\r
{\r
\r
uint64_t now;\r
\r
memset( &shmptr->client[0], 0, shmptr->shmclient_size );\r
shmptr->clientcount = Client_count();\r
- \r
+\r
if( shmptr->clientcount )\r
{\r
Timer_init( &now );\r
while( Client_iterate(&client_itr) != NULL )\r
- { \r
+ {\r
if( client_itr->authenticated )\r
- { \r
+ {\r
channel_t *channel = client_itr->channel;\r
- \r
+\r
strncpy( shmptr->client[cc].username, client_itr->username, 120 );\r
strncpy( shmptr->client[cc].ipaddress, Util_clientAddressToString( client_itr ), INET6_ADDRSTRLEN - 1 );\r
strncpy( shmptr->client[cc].channel, channel->name, 120 );\r
- \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
+\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].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
+\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].self_mute = client_itr->self_mute;\r
shmptr->client[cc].recording = client_itr->recording;\r
shmptr->client[cc].authenticated = client_itr->authenticated;\r
- \r
+\r
shmptr->client[cc].availableBandwidth = client_itr->availableBandwidth;\r
- \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
+\r
shmptr->client[cc].isAdmin = client_itr->isAdmin;\r
shmptr->client[cc].isSuppressed = client_itr->isSuppressed;\r
- \r
+\r
shmptr->client[cc].UDPPackets = client_itr->UDPPackets;\r
shmptr->client[cc].TCPPackets = client_itr->TCPPackets;\r
- \r
- } \r
- cc++; \r
+\r
+ }\r
+ cc++;\r
}\r
- } \r
+ }\r
}\r
void Sharedmemory_alivetick(void)\r
{\r
shmptr->alive++;\r
}\r
\r
-void Sharedmemory_deinit(void) \r
+void Sharedmemory_deinit(void)\r
{\r
close( shm_fd );\r
shm_unlink( shm_file_name );\r