Bind non-listener handles too.

This commit is contained in:
Tony Garnock-Jones 2012-05-03 16:30:43 -04:00
parent 21cc52f4b0
commit 9cf91bb231
1 changed files with 7 additions and 1 deletions

View File

@ -72,10 +72,16 @@
[(topic _ (handle-mapping local-addr socket) _)
(transition (set-remove active-handles local-addr))]))))
(define (bind-socket! s local-addr)
(cond
[(udp-listener? local-addr) (udp-bind! s #f (udp-listener-port local-addr))]
[(udp-handle? local-addr) (udp-bind! s #f 0)]
[else (void)]))
;; UdpAddress -> BootK
(define ((udp-socket-manager local-addr) self-pid)
(define s (udp-open-socket #f #f))
(when (udp-listener? local-addr) (udp-bind! s #f (udp-listener-port local-addr)))
(bind-socket! s local-addr)
(define buffer (make-bytes 65536)) ;; TODO: buffer size control
(transition 'socket-is-open
;; Offers a handle-mapping on the local network so that the