Fixing upnp in syncthing

This commit is contained in:
Lluís Batlle i Rossell 2014-05-28 15:22:51 +02:00
parent a8c9c11f9e
commit 338969701c
2 changed files with 30 additions and 0 deletions

View File

@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
buildInputs = [ go ];
patches = [ ./upnp.patch ];
buildPhase = ''
mkdir -p "./dependencies/src/github.com/calmh/syncthing"

View File

@ -0,0 +1,28 @@
Trying to fix upnp for miniupnpd:
https://github.com/calmh/syncthing/issues/211
diff --git a/upnp/upnp.go b/upnp/upnp.go
index 9de719a..9c85b23 100644
--- a/upnp/upnp.go
+++ b/upnp/upnp.go
@@ -60,14 +60,12 @@ func Discover() (*IGD, error) {
return nil, err
}
- search := []byte(`
-M-SEARCH * HTTP/1.1
-Host: 239.255.255.250:1900
-St: urn:schemas-upnp-org:device:InternetGatewayDevice:1
-Man: "ssdp:discover"
-Mx: 3
-
-`)
+ search := []byte("M-SEARCH * HTTP/1.1\r\n" +
+"Host: 239.255.255.250:1900\r\n" +
+"St: urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n" +
+"Man: \"ssdp:discover\"\r\n" +
+"Mx: 3\r\n" +
+"\r\n")
_, err = socket.WriteTo(search, ssdp)
if err != nil {