Merge "make log_displayer following faster on large files"
diff --git a/aos/build/download_externals.sh b/aos/build/download_externals.sh
index 413d0fc..ca49fd2 100755
--- a/aos/build/download_externals.sh
+++ b/aos/build/download_externals.sh
@@ -213,8 +213,10 @@
 
 # get and build seasocks
 SEASOCKS_VERSION=1.1.2
-SEASOCKS_DIR=${EXTERNALS}/seasocks-${SEASOCKS_VERSION}
-[ -d ${SEASOCKS_DIR} ] || git clone --branch v${SEASOCKS_VERSION} \
-  https://github.com/mattgodbolt/seasocks.git ${SEASOCKS_DIR}
+SEASOCKS_PATCH=1
+SEASOCKS_DIR=${EXTERNALS}/seasocks-${SEASOCKS_VERSION}-p${SEASOCKS_PATCH}
+[ -d ${SEASOCKS_DIR} ] || ( git clone --branch v${SEASOCKS_VERSION} \
+  https://github.com/mattgodbolt/seasocks.git ${SEASOCKS_DIR} && \
+  patch -p1 -d ${SEASOCKS_DIR} < ${AOS}/externals/seasocks.patch )
 
 rm -rf ${TMPDIR}
diff --git a/aos/build/externals.gyp b/aos/build/externals.gyp
index 8764eb7..e72f4f7 100644
--- a/aos/build/externals.gyp
+++ b/aos/build/externals.gyp
@@ -16,7 +16,7 @@
     'libevent_version': '2.0.21',
     'libcdd_version': '094g',
     'stm32flash_commit': '8399fbe1baf2b7d097746786458021d92895d71b',
-    'seasocks_version': '1.1.2',
+    'seasocks_version': '1.1.2-p1',
 
     'allwpilib': '<(AOS)/externals/allwpilib',
     'forwpilib': '<(AOS)/externals/forwpilib',
diff --git a/aos/common/controls/control_loop-tmpl.h b/aos/common/controls/control_loop-tmpl.h
index 44fada1..449ffea 100644
--- a/aos/common/controls/control_loop-tmpl.h
+++ b/aos/common/controls/control_loop-tmpl.h
@@ -38,11 +38,7 @@
 
   // Fetch the latest control loop goal. If there is no new
   // goal, we will just reuse the old one.
-  // If there is no goal, we haven't started up fully.  It isn't worth
-  // the added complexity for each loop implementation to handle that case.
   control_loop_->goal.FetchLatest();
-  // TODO(aschuh): Check the age here if we want the loop to stop on old
-  // goals.
   const GoalType *goal = control_loop_->goal.get();
   if (goal) {
     LOG_STRUCT(DEBUG, "goal", *goal);
diff --git a/aos/externals/seasocks.patch b/aos/externals/seasocks.patch
new file mode 100644
index 0000000..e98c65d
--- /dev/null
+++ b/aos/externals/seasocks.patch
@@ -0,0 +1,40 @@
+diff --git a/src/main/c/HybiPacketDecoder.cpp b/src/main/c/HybiPacketDecoder.cpp
+index f0fdefe..c2971b2 100644
+--- a/src/main/c/HybiPacketDecoder.cpp
++++ b/src/main/c/HybiPacketDecoder.cpp
+@@ -27,6 +27,7 @@
+ #include "internal/LogStream.h"
+ 
+ #include <arpa/inet.h>
++#include <string.h>
+ 
+ namespace seasocks {
+ 
+@@ -56,18 +57,24 @@ HybiPacketDecoder::MessageState HybiPacketDecoder::decodeNextMessage(std::vector
+     auto ptr = _messageStart + 2;
+     if (payloadLength == 126) {
+         if (_buffer.size() < 4) { return NoMessage; }
+-        payloadLength = htons(*reinterpret_cast<const uint16_t*>(&_buffer[ptr]));
++        uint16_t raw_length;
++        memcpy(&raw_length, &_buffer[ptr], sizeof(raw_length));
++        payloadLength = htons(raw_length);
+         ptr += 2;
+     } else if (payloadLength == 127) {
+         if (_buffer.size() < 10) { return NoMessage; }
+-        payloadLength = __bswap_64(*reinterpret_cast<const uint64_t*>(&_buffer[ptr]));
++        uint64_t raw_length;
++        memcpy(&raw_length, &_buffer[ptr], sizeof(raw_length));
++        payloadLength = __bswap_64(raw_length);
+         ptr += 8;
+     }
+     uint32_t mask = 0;
+     if (maskBit) {
+         // MASK is set.
+         if (_buffer.size() < ptr + 4) { return NoMessage; }
+-        mask = htonl(*reinterpret_cast<const uint32_t*>(&_buffer[ptr]));
++        uint32_t raw_length;
++        memcpy(&raw_length, &_buffer[ptr], sizeof(raw_length));
++        mask = htonl(raw_length);
+         ptr += 4;
+     }
+     auto bytesLeftInBuffer = _buffer.size() - ptr;
diff --git a/frc971/http_status/.gitignore b/frc971/http_status/.gitignore
new file mode 100644
index 0000000..68fbdd8
--- /dev/null
+++ b/frc971/http_status/.gitignore
@@ -0,0 +1 @@
+/embedded.h
diff --git a/output/downloaded/.gitignore b/output/downloaded/.gitignore
index 69f5098..b59b5d2 100644
--- a/output/downloaded/.gitignore
+++ b/output/downloaded/.gitignore
@@ -18,3 +18,4 @@
 /gmp-5.1.3.tar.lz
 /gperftools-2.3.tar.gz
 /libunwind-1.1.tar.gz
+/seasocks-1.1.2-p1/