I'm working on adapting some existing communication middleware of mine into a node module. The existing code uses boost::asio to create, bind, and read asynchronously from sockets. I'd like to keep this architecture so I can embed my functionality in many different contexts without writing, say, one version in JavaScript and socket.io and another in python and so on. I thought it would be relatively straightforward to implement this in node; however, I'm really up against a wall. It seems like there might be some deep seated incompatibility between node and boost::asio. I'm open to doing this differently, but I'm at loss to explain why this is failing.
The failure is mode is somewhat non-deterministic. For example, sometimes the process will deadlock on socket creation in boost::asio. Other times the process will crash because the io_service op_queue for boost::asio has a garbage pointer. And other times everything proceeds without a crash but the io_service queue is always empty and manually polling fails to call any handlers. All of the above could be caused by any number of terrible coding flaws; however, I've carefully gone through the process with valgrind and gdb and the results are sooooo bizarre! I've incorporated this communication module in python code and in multithreaded C++/Qt applications with no problems whatsoever, yet something about loading this in the node environment has completely gone awry. Is there something fundamentally wrong with this approach? If I must use a different socket API from within the node module it wouldn't be the end of the world, but I'd rather not do too much reimplementing if I don't have to. I'm hoping someone here could at least shed some light on why using the boost::asio socket API is impossible. And if it is possible, well, then I need to direct my efforts to figuring out what I did wrong. I'm using boost 1.47, gcc 4.6.1, node 0.6.12, and Red Hat Linux. Thanks! -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
