Skip to content

Commit

Permalink
added setsockopt on http connection
Browse files Browse the repository at this point in the history
  • Loading branch information
kjessup committed Oct 5, 2016
1 parent f2b7f04 commit 2dba640
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ fastlane/test_output

Packages/
*.xcodeproj/
.DS_Store
11 changes: 11 additions & 0 deletions Sources/PerfectHTTPServer/HTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ import PerfectThread
import PerfectLib
import PerfectHTTP

#if os(Linux)
import SwiftGlibc
import LinuxBridge
#else
import Darwin
#endif

/// Stand-alone HTTP server. Provides the same WebConnection based interface as the FastCGI server.
public class HTTPServer {

Expand Down Expand Up @@ -214,6 +221,10 @@ public class HTTPServer {
}

func handleConnection(_ net: NetTCP) {

var flag = 1
_ = setsockopt(net.fd.fd, IPPROTO_TCP, TCP_NODELAY, &flag, UInt32(MemoryLayout<Int32>.size))

let req = HTTP11Request(connection: net)
req.serverName = self.serverName
req.readRequest { [weak self]
Expand Down

0 comments on commit 2dba640

Please sign in to comment.