summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/socket/unix/transport/connectioned.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/socket/unix/transport/connectioned.go')
-rw-r--r--pkg/sentry/socket/unix/transport/connectioned.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/sentry/socket/unix/transport/connectioned.go b/pkg/sentry/socket/unix/transport/connectioned.go
index 4bd15808a..dea11e253 100644
--- a/pkg/sentry/socket/unix/transport/connectioned.go
+++ b/pkg/sentry/socket/unix/transport/connectioned.go
@@ -220,6 +220,11 @@ func (e *connectionedEndpoint) Close() {
case e.Connected():
e.connected.CloseSend()
e.receiver.CloseRecv()
+ // Still have unread data? If yes, we set this into the write
+ // end so that the peer can get ECONNRESET) when it does read.
+ if e.receiver.RecvQueuedSize() > 0 {
+ e.connected.CloseUnread()
+ }
c = e.connected
r = e.receiver
e.connected = nil