net: pass a function pointer to check if need retry

This is a prepare patch for 'retry write'.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
sheep: retry write for EAGAIN

Since we set timeout for write, we'll get EAGAIN even for blocking sockfd.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>