[gamin] Re-using gamin socket



Hey,

So I'm writing a node.js wrapper around fam/gamin, but I'm having some weird behavior in my unit tests.

First run, everything works perfectly. On the second run, however, gamin hangs unless I've killed gam_server between runs. I'm running the latest version of gamin.

First run:
 [ will on buttons ] ( fam.js ) % npm test                                                                                                           [0]

> fam.js@1.2.0 test /home/will/Projects/fam.js
> ./node_modules/.bin/nodeunit test


00-test-fam-watch
FAMOpen()
Reusing socket directory /tmp/fam-will
Asking to launch /usr/libexec/gam_server with client id test
Reusing socket directory /tmp/fam-will
Reusing socket directory /tmp/fam-will
Connected to socket /tmp/fam-will/fam-test : 7
Wrote credential bytes to socket 7
Activating thread safety
FAMMonitorDirectory(/tmp)
Wrote 14 bytes to socket 7
gamin_send_request 1 for socket 7
FAMNextEvent(fd = 7)
Client need auth 7
read credentials byte
Credentials: s_uid 1001, c_uid 1001, c_gid 1001, c_pid 30233
read 27 bytes from server
accepted event: seq 1, type 1
FAMNextEvent : Changed : fam.js-test-watch
FAMCancelMonitor(1)
Wrote 10 bytes to socket 7
gamin_send_request 1 for socket 7
FAMClose()
✔ test_fam_watch

01-test-fam-add
FAMOpen()
Reusing socket directory /tmp/fam-will
Connected to socket /tmp/fam-will/fam-test : 7
Wrote credential bytes to socket 7
FAMMonitorDirectory(/tmp)
Wrote 14 bytes to socket 7
gamin_send_request 1 for socket 7
FAMMonitorDirectory(/var/tmp)
Wrote 18 bytes to socket 7
gamin_send_request 2 for socket 7
FAMMonitorDirectory(/var)
Wrote 14 bytes to socket 7
gamin_send_request 3 for socket 7
FAMMonitorDirectory(/var/cache)
Wrote 20 bytes to socket 7
gamin_send_request 4 for socket 7
FAMOpen()
Reusing socket directory /tmp/fam-will
Connected to socket /tmp/fam-will/fam-test : 9
Wrote credential bytes to socket 9
FAMOpen()
Reusing socket directory /tmp/fam-will
Connected to socket /tmp/fam-will/fam-test : 10
Wrote credential bytes to socket 10
✔ test_fam_add

OK: 6 assertions (1183ms)

Second run:
 [ will on buttons ] ( fam.js ) % npm test                                                                                                           [0]

> fam.js@1.2.0 test /home/will/Projects/fam.js
> ./node_modules/.bin/nodeunit test


00-test-fam-watch
FAMOpen()
Reusing socket directory /tmp/fam-will
Connected to socket /tmp/fam-will/fam-test : 7
Wrote credential bytes to socket 7
Activating thread safety
FAMMonitorDirectory(/tmp)
Wrote 14 bytes to socket 7
gamin_send_request 1 for socket 7
FAMNextEvent(fd = 7)
Client need auth 7

Obviously, since I'm writing a node module, I'm using libuv, and FAMNextEvent() is being called in a separate thread.

What am I doing wrong?

Thanks!

--
Will Orr

http://about.me/worr




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]