Skip to content

Commit

Permalink
set socket to none block mode
Browse files Browse the repository at this point in the history
Signed-off-by: aoxn <spacex_nice@163.com>
  • Loading branch information
aoxn committed Jan 14, 2022
1 parent d70a053 commit c215416
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ var _ net.Conn = (*VirtioSocketConnection)(nil)
func newVirtioSocketConnection(ptr unsafe.Pointer) *VirtioSocketConnection {
id := xid.New().String()
vzVirtioSocketConnection := C.convertVZVirtioSocketConnection2Flat(ptr)
err := unix.SetNonblock(int(vzVirtioSocketConnection.fileDescriptor), true)
if err != nil {
fmt.Printf("set nonblock: %s\n", err.Error())
}
conn := &VirtioSocketConnection{
id: id,
sourcePort: (uint32)(vzVirtioSocketConnection.sourcePort),
Expand Down

0 comments on commit c215416

Please sign in to comment.