(bind-func node_reply_loop 30000
(let ((buf:i8* (zalloc FLEET_NANOMSG_SERVER_BUFLEN))
(repbufptr:i8** (zalloc)))
(lambda ()
(println "starting reply_loop...")
(while FLEET_NANOMSG_SERVER_RUNNING
(let ((reqbytes (nn_recv FLEET_NANOMSG_SERVER_SOCKET buf FLEET_NANOMSG_SERVER_BUFLEN 0)))
(if (> reqbytes 0)
(let ((bytes (node_reply_function buf FLEET_NANOMSG_SERVER_BUFLEN repbufptr)))
(if (> bytes 0)
(if (< (nn_send FLEET_NANOMSG_SERVER_SOCKET (pref repbufptr 0) (+ 1 (convert bytes)) 0) 0)
(nn_println_strerror "error in node_reply_loop")))))))
(println "stopping node_reply_loop"))))