[server] Add timeout in block transfer worker thread.

This prevents the worker threads from waiting for incomming
data indefinitely and starving other clients.
More accurate uploading block list.

In the old algorithm, some blocks that have been uploaded before
may still be included in the uploading block list.
The new algorithm only includes the new blocks added locally.