Handle streams becoming unassociated before the VLOG
It's annoying when the debug printing code crashes...
Change-Id: Ia4140f3ab5d2cecb6a613c56aaf14e85e403431f
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/network/sctp_lib.cc b/aos/network/sctp_lib.cc
index b522851..babe7ab 100644
--- a/aos/network/sctp_lib.cc
+++ b/aos/network/sctp_lib.cc
@@ -165,8 +165,13 @@
status.sstat_assoc_id = assoc_id;
socklen_t size = sizeof(status);
- PCHECK(getsockopt(fd, SOL_SCTP, SCTP_STATUS,
- reinterpret_cast<void *>(&status), &size) == 0);
+ const int result = getsockopt(fd, SOL_SCTP, SCTP_STATUS,
+ reinterpret_cast<void *>(&status), &size);
+ if (result == -1 && errno == EINVAL) {
+ LOG(INFO) << "sctp_status) not associated";
+ return;
+ }
+ PCHECK(result == 0);
LOG(INFO) << "sctp_status) sstat_assoc_id:" << status.sstat_assoc_id
<< " sstat_state:" << status.sstat_state