digidem / osm-p2p-server

Peer-to-peer OpenStreetMap API v0.6 Server for osm-p2p-db
BSD 2-Clause "Simplified" License
87 stars 10 forks source link

Fix and test for downloading empty changesets #14

Closed gmaclennan closed 8 years ago

ghost commented 8 years ago

One part that seems a little off is: https://github.com/digidem/osm-p2p-server/blob/bba11ce97a4d5ffb2cf6b4c00daddaca04513c74/lib/routes.js#L109

If more than 1 of the ids in the ids array create an error, res.end() will double-fire and crash the process. Here's how I solved that issue in another spot with a sent boolean: https://github.com/digidem/osm-p2p-server/blob/bba11ce97a4d5ffb2cf6b4c00daddaca04513c74/lib/routes.js#L244