Skip to content

Commit 9ac8782

Browse files
committed
Set socket ReusePort
Sometimes the ttrpc server can not release the address it was binding to after restarting, so we set ReusePort to solve this situation. Signed-off-by: Tim Zhang <[email protected]>
1 parent b435713 commit 9ac8782

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/common.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ pub fn do_bind(host: &str) -> Result<(RawFd, Domain)> {
9696
}
9797
};
9898

99+
setsockopt(fd, sockopt::ReusePort, &true).ok();
99100
bind(fd, &sockaddr).map_err(err_to_Others!(e, ""))?;
100101

101102
Ok((fd, domain))

0 commit comments

Comments
 (0)