server: make accept socket non-blocking
pqueue: fix pqueue_delete

pqueue_delete didn't take into account the case where the last element
in the heap array was 'bigger' than the parent of the element being
deleted. This is fixed by pushing the element up the heap in that case.

Also added test cases that reproduced the issue to test_pqueue.