diff options
author | sr | 2012-08-30 00:36:54 +0200 |
---|---|---|
committer | sr | 2012-08-30 00:36:54 +0200 |
commit | 5b9b2174512d97399c68172bffe91cf928b1400a (patch) | |
tree | bf2cb9a7ae67cfe922fc7d2a6dcb432eaad4a2d9 /src/server/server.c | |
parent | Fix linebreak, add comment (diff) | |
download | dnbd3-5b9b2174512d97399c68172bffe91cf928b1400a.tar.gz dnbd3-5b9b2174512d97399c68172bffe91cf928b1400a.tar.xz dnbd3-5b9b2174512d97399c68172bffe91cf928b1400a.zip |
[SERVER] Set _FILE_OFFSET_BITS=64 so that images >4GiB will be handled properly on 32bit
[SERVER] Change IPC interface to be able to handle more than 1 request per connection
[SERVER] Change IPC interface to use select() so it can handle multiple connections at the same time
[SERVER] Re-Implement dnbd3_add_image() to work with image list
[SERVER] Add lots of sanity/safety checks and error messages when loading/adding an image
Diffstat (limited to 'src/server/server.c')
-rw-r--r-- | src/server/server.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/server/server.c b/src/server/server.c index 965c368..10a1d2f 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -44,7 +44,8 @@ pthread_spinlock_t _spinlock; GSList *_dnbd3_clients = NULL; char *_config_file_name = DEFAULT_SERVER_CONFIG_FILE; -GSList *_dnbd3_images; // of dnbd3_image_t +char *_local_namespace = NULL; +GSList *_dnbd3_images = NULL; // of dnbd3_image_t void dnbd3_print_help(char* argv_0) { @@ -76,6 +77,8 @@ void dnbd3_cleanup() close(_sock); + dnbd3_ipc_shutdown(); + pthread_spin_lock(&_spinlock); GSList *iterator = NULL; for (iterator = _dnbd3_clients; iterator; iterator = iterator->next) @@ -209,9 +212,9 @@ int main(int argc, char* argv[]) timeout.tv_sec = SOCKET_TIMEOUT_SERVER; timeout.tv_usec = 0; - // setup icp + // setup ipc pthread_t thread_ipc; - pthread_create(&(thread_ipc), NULL, dnbd3_ipc_receive, NULL); + pthread_create(&(thread_ipc), NULL, &dnbd3_ipc_mainloop, NULL); memlogf("[INFO] Server is ready..."); @@ -246,7 +249,7 @@ int main(int argc, char* argv[]) // This has to be done before creating the thread, otherwise a race condition might occur when the new thread dies faster than this thread adds the client to the list after creating the thread pthread_spin_lock(&_spinlock); - _dnbd3_clients = g_slist_append(_dnbd3_clients, dnbd3_client); + _dnbd3_clients = g_slist_prepend(_dnbd3_clients, dnbd3_client); pthread_spin_unlock(&_spinlock); if (0 != pthread_create(&(dnbd3_client->thread), NULL, dnbd3_handle_query, (void *) (uintptr_t) dnbd3_client)) |