accept function and wake up logic