mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-20 19:11:08 +03:00
our TCP listener is nonblocking so we *must* set the accepted stream to blocking explicitly... (#3154)
This commit is contained in:
parent
c46343f279
commit
7f7d51a748
1 changed files with 8 additions and 0 deletions
|
@ -84,6 +84,14 @@ impl Server {
|
|||
|
||||
match listener.accept() {
|
||||
Ok((stream, peer_addr)) => {
|
||||
// We want out TCP stream to be in blocking mode.
|
||||
// The TCP listener is in nonblocking mode so we *must* explicitly
|
||||
// move the accepted TCP stream into blocking mode (or all kinds of
|
||||
// bad things can and will happen).
|
||||
// A nonblocking TCP listener will accept nonblocking TCP streams which
|
||||
// we do not want.
|
||||
stream.set_nonblocking(false)?;
|
||||
|
||||
let peer_addr = PeerAddr(peer_addr);
|
||||
|
||||
if self.check_undesirable(&stream) {
|
||||
|
|
Loading…
Reference in a new issue