<commit_before>//
//  Socket+forceClose.swift
//  HAP
//
//  Created by <NAME> on 10/10/2018.
//

import Foundation
import Socket

#if os(macOS) || os(iOS) || os(tvOS)
import Darwin
#elseif os(Linux)
import Glibc
#endif

extension Socket {

    // Avoid race conditions in BlueSocket when closing a socket from another
    // thread by closing the sockets file descriptor using system calls.
    //
    // Assumes socket is being listened to and is connected
    //
    // swiftlint:disable:next identifier_name
    static func forceClose(socketfd fd: Int32) {
        #if os(Linux)
        _ = Glibc.shutdown(fd, Int32(SHUT_RDWR))
        _ = Glibc.close(fd)
        #else
        _ = Darwin.shutdown(fd, Int32(SHUT_RDWR))
        _ = Darwin.close(fd)
        #endif
    }
}
<commit_msg>Remove Xcode file header<commit_after>import Foundation
import Socket

#if os(macOS) || os(iOS) || os(tvOS)
import Darwin
#elseif os(Linux)
import Glibc
#endif

extension Socket {

    // Avoid race conditions in BlueSocket when closing a socket from another
    // thread by closing the sockets file descriptor using system calls.
    //
    // Assumes socket is being listened to and is connected
    //
    // swiftlint:disable:next identifier_name
    static func forceClose(socketfd fd: Int32) {
        #if os(Linux)
        _ = Glibc.shutdown(fd, Int32(SHUT_RDWR))
        _ = Glibc.close(fd)
        #else
        _ = Darwin.shutdown(fd, Int32(SHUT_RDWR))
        _ = Darwin.close(fd)
        #endif
    }
}

{'fraction_non_alphanumeric': 0.10172872340425532, 'fraction_numerical': 0.013297872340425532, 'mean_word_length': 2.5748218527315916, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '238934', 'n_tokens_mistral': 503, 'n_tokens_neox': 480, 'n_words': 139}