Ignore EAGAIN when sending

This means that the buffer is probably full.  Treat the packet like it
was dropped (it was).

Change-Id: I7cd881cc1aa6bfb04d7cb7b5c9450f316ef53999
diff --git a/aos/network/message_bridge_server_lib.cc b/aos/network/message_bridge_server_lib.cc
index e5222fc..3607449 100644
--- a/aos/network/message_bridge_server_lib.cc
+++ b/aos/network/message_bridge_server_lib.cc
@@ -97,12 +97,12 @@
   for (Peer &peer : peers_) {
     logged_remotely = logged_remotely || peer.logged_remotely;
 
-    if (peer.sac_assoc_id != 0) {
-      server->Send(std::string_view(
-                       reinterpret_cast<const char *>(fbb.GetBufferPointer()),
-                       fbb.GetSize()),
-                   peer.sac_assoc_id, peer.stream,
-                   peer.connection->time_to_live() / 1000000);
+    if (peer.sac_assoc_id != 0 &&
+        server->Send(std::string_view(
+                         reinterpret_cast<const char *>(fbb.GetBufferPointer()),
+                         fbb.GetSize()),
+                     peer.sac_assoc_id, peer.stream,
+                     peer.connection->time_to_live() / 1000000)) {
       peer.server_connection_statistics->mutate_sent_packets(
           peer.server_connection_statistics->sent_packets() + 1);
       if (peer.logged_remotely) {
diff --git a/aos/network/sctp_server.cc b/aos/network/sctp_server.cc
index 093e3f0..6e32c8a 100644
--- a/aos/network/sctp_server.cc
+++ b/aos/network/sctp_server.cc
@@ -80,7 +80,7 @@
   return ReadSctpMessage(fd_, max_size_);
 }
 
-void SctpServer::Send(std::string_view data, sctp_assoc_t snd_assoc_id,
+bool SctpServer::Send(std::string_view data, sctp_assoc_t snd_assoc_id,
                       int stream, int timetolive) {
   struct iovec iov;
   iov.iov_base = const_cast<char *>(data.data());
@@ -116,11 +116,14 @@
   // And send.
   const ssize_t size = sendmsg(fd_, &outmsg, MSG_NOSIGNAL | MSG_DONTWAIT);
   if (size == -1) {
-    if (errno != EPIPE) {
-      PCHECK(size == static_cast<ssize_t>(data.size()));
+    if (errno == EPIPE || errno == EAGAIN) {
+      return false;
     }
+    PCHECK(size == static_cast<ssize_t>(data.size()));
+    return false;
   } else {
     CHECK_EQ(static_cast<ssize_t>(data.size()), size);
+    return true;
   }
 }
 
diff --git a/aos/network/sctp_server.h b/aos/network/sctp_server.h
index 25d81fc..8fa3d15 100644
--- a/aos/network/sctp_server.h
+++ b/aos/network/sctp_server.h
@@ -31,8 +31,9 @@
   // Receives the next packet from the remote.
   aos::unique_c_ptr<Message> Read();
 
-  // Sends a block of data to a client on a stream with a TTL.
-  void Send(std::string_view data, sctp_assoc_t snd_assoc_id, int stream,
+  // Sends a block of data to a client on a stream with a TTL.  Returns true on
+  // success.
+  bool Send(std::string_view data, sctp_assoc_t snd_assoc_id, int stream,
             int timetolive);
 
   int fd() { return fd_; }