diff options
author | Simon Rettberg | 2014-06-16 19:24:17 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-06-16 19:24:17 +0200 |
commit | 49f9218d330f5842fe24bce79267bd2c5b239df3 (patch) | |
tree | 74e7b49e9c058145069ac4e2aa6de5d9f2cac3ce /src/server/server.c | |
parent | [CLIENT] Debug argument handling in daemon mode (diff) | |
download | dnbd3-49f9218d330f5842fe24bce79267bd2c5b239df3.tar.gz dnbd3-49f9218d330f5842fe24bce79267bd2c5b239df3.tar.xz dnbd3-49f9218d330f5842fe24bce79267bd2c5b239df3.zip |
Improve uplink handling, add code to debug thread creation/destruction, change stupid convention of freeDiskSpace returning 0 on error, which is ambiguous to the disk simply being full...
Diffstat (limited to 'src/server/server.c')
-rw-r--r-- | src/server/server.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/server/server.c b/src/server/server.c index f19b4fe..844365b 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -326,7 +326,10 @@ int main(int argc, char *argv[]) // setup rpc //pthread_t thread_rpc; - //pthread_create(&(thread_rpc), NULL, &dnbd3_rpc_mainloop, NULL); + //thread_create(&(thread_rpc), NULL, &dnbd3_rpc_mainloop, NULL); + pthread_attr_t threadAttrs; + pthread_attr_init( &threadAttrs ); + pthread_attr_setdetachstate( &threadAttrs, PTHREAD_CREATE_DETACHED ); memlogf( "[INFO] Server is ready..." ); @@ -372,16 +375,14 @@ int main(int argc, char *argv[]) continue; } - pthread_attr_t threadAttrs; - pthread_attr_init( &threadAttrs ); - pthread_attr_setdetachstate( &threadAttrs, PTHREAD_CREATE_DETACHED ); - if ( 0 != pthread_create( &(dnbd3_client->thread), &threadAttrs, net_client_handler, (void *)(uintptr_t)dnbd3_client ) ) { + if ( 0 != thread_create( &(dnbd3_client->thread), &threadAttrs, net_client_handler, (void *)(uintptr_t)dnbd3_client ) ) { memlogf( "[ERROR] Could not start thread for new client." ); dnbd3_remove_client( dnbd3_client ); dnbd3_client = dnbd3_free_client( dnbd3_client ); continue; } } + pthread_attr_destroy( &threadAttrs ); dnbd3_cleanup(); } |