Patrick Brosi 4 gadi atpakaļ
vecāks
revīzija
06c8a1710a
2 mainītis faili ar 20 papildinājumiem un 8 dzēšanām
  1. 12 4
      src/osmfixer/index/StatIdx.cpp
  2. 8 4
      src/util/http/Server.cpp

+ 12 - 4
src/osmfixer/index/StatIdx.cpp

@@ -297,14 +297,22 @@ void StatIdx::initGroups() {
297 297
       _groups[_stations[i].origGroup].stations.push_back(i);
298 298
     }
299 299
 
300
-    if (_stations[i].group != _stations[i].origGroup &&
301
-        _groups[_stations[i].group].osmid > 2 &&
300
+    // if all stations of a relation are moved into another same relation,
301
+    // suggest to merge the relation instead of suggesting each invidivual
302
+    // move
303
+    if (_groups[_stations[i].group].osmid > 2 &&
302 304
         _groups[_stations[i].origGroup].osmid > 2) {
303 305
       auto& orGr = _groups[_stations[i].origGroup];
304
-      if (orGr.mergeId == 0)
306
+      if (orGr.mergeId == 0) {
307
+        // if no merge group has been yet written, set it to the target group
308
+        // of the currently check station
305 309
         orGr.mergeId = _stations[i].group;
306
-      else if (orGr.mergeId != _stations[i].group)
310
+      } else if (orGr.mergeId != _stations[i].group) {
311
+        // if a merge group was set, but the current station is not moved into
312
+        // this group, set the merge id to the group id. This is later inter-
313
+        // preted as DO NOT MERGE
307 314
         orGr.mergeId = orGr.id;
315
+      }
308 316
     }
309 317
 
310 318
     assert(_stations[i].group < _groups.size());

+ 8 - 4
src/util/http/Server.cpp

@@ -11,6 +11,7 @@
11 11
 #include <netinet/in.h>
12 12
 #include <netinet/tcp.h>
13 13
 #include <algorithm>
14
+#include <csignal>
14 15
 #include <memory>
15 16
 #include <sstream>
16 17
 #include <stdexcept>
@@ -24,12 +25,12 @@
24 25
 #include "util/String.h"
25 26
 #include "util/log/Log.h"
26 27
 
27
-using util::http::Socket;
28
-using util::http::Queue;
29
-using util::http::Req;
28
+using util::http::HeaderState;
30 29
 using util::http::HttpErr;
31 30
 using util::http::HttpServer;
32
-using util::http::HeaderState;
31
+using util::http::Queue;
32
+using util::http::Req;
33
+using util::http::Socket;
33 34
 
34 35
 // _____________________________________________________________________________
35 36
 Socket::Socket(int port) {
@@ -71,6 +72,9 @@ int Socket::wait() {
71 72
 
72 73
 // _____________________________________________________________________________
73 74
 void HttpServer::send(int sock, Answer* aw) {
75
+  // ignore SIGPIPE
76
+  signal(SIGPIPE, SIG_IGN);
77
+
74 78
   std::string enc = "identity";
75 79
   if (aw->gzip) aw->pl = compress(aw->pl, &enc);
76 80