Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Forgot to insert short_addr

  • Loading branch information...
commit 907f7233ef91680b020d53b41d7967ce5692792f 1 parent e4c9da3
@indutny authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/tracker/storage.mongo.js
View
7 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;
Please sign in to comment.
Something went wrong with that request. Please try again.