Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FlyingSocks/Sources/AsyncSocket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public struct AsyncSocket: Sendable {

@Sendable
public func accept() async throws -> AsyncSocket {
try await pool.loopUntilReady(for: .connection, on: socket) {
try await pool.loopUntilReady(for: .read, on: socket) {
let file = try socket.accept().file
let socket = Socket(file: file)
return try AsyncSocket(socket: socket, pool: pool)
Expand Down
5 changes: 4 additions & 1 deletion FlyingSocks/Sources/SocketPool+ePoll.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public struct ePoll: EventQueue {
}

mutating func setEvents(_ events: Socket.Events, for socket: Socket.FileDescriptor) throws {
if existing[socket] == events { return }
var event = CSystemLinux.epoll_event()
event.events = events.epollEvents.rawValue
event.data.fd = socket.rawValue
Expand Down Expand Up @@ -242,7 +243,9 @@ private struct EPOLLEvents: OptionSet, Hashable {
private extension Socket.Events {

var epollEvents: EPOLLEvents {
reduce(EPOLLEvents()) { [$0, $1.epollEvent] }
var events = reduce(EPOLLEvents()) { [$0, $1.epollEvent] }
events.insert(.edgeTriggered)
return events
}

static func make(from pollevents: EPOLLEvents) -> Socket.Events {
Expand Down
Loading