Skip to content

Commit

Permalink
Merge pull request #16 from Ahti/master
Browse files Browse the repository at this point in the history
fix Socket.blocking implementation
  • Loading branch information
kylef committed Jan 2, 2016
2 parents 41b7599 + 9b56db3 commit 92ab176
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ class Socket {
var blocking: Bool {
get {
let flags = fcntl(descriptor, F_GETFL, 0)
return flags & O_NONBLOCK == 1
return flags & O_NONBLOCK == 0
}

set {
let flags = fcntl(descriptor, F_GETFL, 0)
let newFlags: Int32

if newValue {
newFlags = flags ^ O_NONBLOCK
newFlags = flags & ~O_NONBLOCK
} else {
newFlags = flags | O_NONBLOCK
}
Expand Down

0 comments on commit 92ab176

Please sign in to comment.