Skip to content

Commit

Permalink
Merge pull request #67 from Code-Hex/fix/socket-2
Browse files Browse the repository at this point in the history
socket: Do not release the shared devices pointer
  • Loading branch information
Code-Hex authored Oct 12, 2022
2 parents a90c744 + 9155e48 commit e32e0fe
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,12 @@ type VirtioSocketDevice struct {
}

func newVirtioSocketDevice(ptr, dispatchQueue unsafe.Pointer) *VirtioSocketDevice {
socketDevice := &VirtioSocketDevice{
return &VirtioSocketDevice{
dispatchQueue: dispatchQueue,
pointer: pointer{
ptr: ptr,
},
}
runtime.SetFinalizer(socketDevice, func(self *VirtioSocketDevice) {
self.Release()
})
return socketDevice
}

// SetSocketListenerForPort configures an object to monitor the specified port for new connections.
Expand Down Expand Up @@ -157,9 +153,6 @@ func NewVirtioSocketListener(handler func(conn *VirtioSocketConnection, err erro
return true // must be connected
}

runtime.SetFinalizer(listener, func(self *VirtioSocketListener) {
self.Release()
})
return listener, nil
}

Expand Down

0 comments on commit e32e0fe

Please sign in to comment.