JustinTulloss/zeromq.node — pull request #199 by AlexeyKupershtokh (2013-03-31 18:36:20+00:00)
Title: WIP: Prevent zeromq sockets from being destroyed by GC.

I've likely fixed a GC-related problem with early exiting in scripts like this one:
```js
var zmq = require('zmq');
var a = zmq.socket('dealer');
a.on('message', function() {});
a.bind('tcp://127.0.0.1:5555');
```
As you can see when the main loop finished, variable `a` is unreferenced and the socket is destroyed by the GC (which is started in a few seconds usually). I've created a robust test `test.gc.js` that can check for sure whether a similar socket is destroyed or not. Initially it failed on the master version but now it seems to be working ok.

My PR proposes adding calls to Ref/Unref in order to notify v8 that we still need the object. I'm not sure if we need to additionally call uv_ref and uv_unref.

As far as single socket can be connected or bound to multiple endpoints, I added a Socket::endpoints property for counting those. Ref/Unref calls are only performed when the number of active endpoints changes from 0 to 1 or from 1 to 0.

This PR also makes the gcWrap stuff useless so I removed it.

/cc @sannis @wavded and others please review.