File: fix-mips

package info (click to toggle)
haskell-io-streams-haproxy 1.0.1.0-4
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 152 kB
  • sloc: haskell: 789; ansic: 18; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 1,077 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Description: Correctly retrieve the type of the socket
 On mips, `SOCK_STREAM` and `SOCK_DGRAM` have different values than on
 x86_64. Modify `getSockType` to use functions from the Network library
 to retrieve the type of the socket, instead of relying on hard-coded
 values.
Author: Ilias Tsitsimpis <iliastsi@debian.org>
Bug: https://github.com/snapframework/io-streams-haproxy/issues/18

--- a/src/System/IO/Streams/Network/HAProxy.hs
+++ b/src/System/IO/Streams/Network/HAProxy.hs
@@ -72,15 +72,8 @@
     !sty <- getSockType
     return $! makeProxyInfo sa da (addrFamily sa) sty
   where
-#if MIN_VERSION_network(2,7,0)
-    getSockType = do
-        c <- N.getSocketOption s N.Type
-        -- This is a kludge until network has better support for returning
-        -- SocketType
-        case c of
-          1 -> return N.Stream
-          2 -> return N.Datagram
-          _ -> error ("bad socket type: " ++ show c)
+#if MIN_VERSION_network(3,0,1)
+    getSockType = N.getSocketType s
 #else
     getSockType = let (N.MkSocket _ _ sty _ _) = s in return sty
 #endif