Skip to content

Commit 3d357f1

Browse files
authored
Merge pull request #12 from lyft/nosigpipe
Handle SIGPIPE on the UDP socket
2 parents d12f364 + 8512899 commit 3d357f1

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
All notable changes to this project will be documented in this file.
33
`Kronos` adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [0.2.2](https://github.com/lyft/Kronos/releases/tag/0.2.1)
6+
- Add NOSIGPIPE to socket so the app doesn't crash on the event of a
7+
PIPE signal
8+
59
## [0.2.1](https://github.com/lyft/Kronos/releases/tag/0.2.1)
610
- Fix crash on DNS timeout after Swift 3 integration
711

Kronos.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Kronos'
3-
s.version = '0.2.1'
3+
s.version = '0.2.2'
44
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
55
s.summary = 'Elegant NTP client in Swift'
66
s.homepage = 'https://github.com/lyft/Kronos'

Sources/NTPClient.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ final class NTPClient {
179179

180180
let runLoopSource = CFSocketCreateRunLoopSource(kCFAllocatorDefault, socket, 0)
181181
CFRunLoopAddSource(CFRunLoopGetMain(), runLoopSource, CFRunLoopMode.commonModes)
182+
183+
var noSIGPIPE: UInt32 = 1
184+
setsockopt(CFSocketGetNative(socket), SOL_SOCKET, SO_NOSIGPIPE, &noSIGPIPE, 4)
182185
CFSocketConnectToAddress(socket, ip.addressData(withPort: port), timeout)
183186
return (runLoopSource!, socket)
184187
}

0 commit comments

Comments
 (0)