fix race in socket code

Evan Hunt requested to merge 834-fix-race-in-fctx-cancel into master

Closes #834 (closed)

Merge request reports