Permalink
Browse files

Forgot to insert short_addr

  • Loading branch information...
1 parent e4c9da3 commit 907f7233ef91680b020d53b41d7967ce5692792f @indutny committed Dec 6, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/tracker/storage.mongo.js
@@ -49,9 +49,14 @@ Storage.prototype.put = function(event, peer, callback) {
if (!instance) {
// Create
var sanitized = helpers.sanitize(peer);
- sanitized.updated_at = peer.updated_at;
+ sanitized.updated_at = peer.updated_at;
instance = new (db.Peer)(sanitized);
+
+ var ip = peer.ip.split('.'),
+ port = String.fromCharCode(peer.port >> 8, peer.port % 256);
+
+ instance.short_addr = String.fromCharCode.apply('', ip) + port;
} else {
// Update
instance.updated_at = peer.updated_at;

0 comments on commit 907f723

Please sign in to comment.