extension ConnectionState {
    static func reducer(state: inout ConnectionState, action: ConnectionAction) {
        switch action {
        case .srvRecordsUpdated(let records):
            state.srvRecords = records

        case .connectionUpdated(let status):
            if state.socketStatus != status {
                state.socketStatus = status
            }

        case .connected(let host, let port):
            state.host = host
            state.port = port

        default:
            break
        }
    }
}
