main: close tx half of sockets with closed rx half

fixes Gitea issue #9
This commit is contained in:
Astro 2020-09-30 23:35:51 +02:00
parent d4e7036fab
commit 026dd1ed9c
1 changed files with 3 additions and 1 deletions

View File

@ -194,7 +194,9 @@ fn main() -> ! {
if ! socket.is_active() { if ! socket.is_active() {
let _ = socket.listen(TCP_PORT); let _ = socket.listen(TCP_PORT);
session.reset(); session.reset();
} else if socket.can_send() && socket.can_recv() && socket.send_capacity() - socket.send_queue() > 1024 { } else if socket.may_send() && !socket.may_recv() {
socket.close()
} else if socket.can_send() && socket.can_recv() {
match socket.recv(|buf| session.feed(buf)) { match socket.recv(|buf| session.feed(buf)) {
Ok(SessionInput::Nothing) => {} Ok(SessionInput::Nothing) => {}
Ok(SessionInput::Command(command)) => match command { Ok(SessionInput::Command(command)) => match command {