apply headroom in process func
move path handling logic to socket