]> gitweb.factorcode.org Git - factor.git/commitdiff
Tweak: don't put UDP receive buffer in image
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 4 Jul 2008 01:50:01 +0000 (20:50 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Fri, 4 Jul 2008 01:50:01 +0000 (20:50 -0500)
extra/io/unix/sockets/sockets.factor

index b9d77a8a80446ac27fa03a09e975313fca3e601d..8e0cb570efc8a39b5b5b6c2de136e6e93320a173 100755 (executable)
@@ -5,7 +5,7 @@ namespaces threads sequences byte-arrays io.ports
 io.binary io.unix.backend io.streams.duplex
 io.backend io.ports io.files io.files.private
 io.encodings.utf8 math.parser continuations libc combinators
-system accessors qualified destructors unix locals ;
+system accessors qualified destructors unix locals init ;
 
 EXCLUDE: io => read write close ;
 EXCLUDE: io.sockets => accept ;
@@ -96,7 +96,7 @@ SYMBOL: receive-buffer
 
 : packet-size 65536 ; inline
 
-packet-size <byte-array> receive-buffer set-global
+[ packet-size malloc receive-buffer set-global ] "io.unix.sockets" add-init-hook
 
 :: do-receive ( port -- packet sockaddr )
     port addr>> empty-sockaddr/size [| sockaddr len |
@@ -107,7 +107,7 @@ packet-size <byte-array> receive-buffer set-global
         sockaddr ! from
         len <int> ! fromlen
         recvfrom dup 0 >= [
-            receive-buffer get-global swap head sockaddr
+            receive-buffer get-global swap memory>byte-array sockaddr
         ] [
             drop f f
         ] if