mutex_unlock(&con->sock_mutex);
}
-/* We only send shutdown messages to nodes that are not part of the cluster */
+/* We only send shutdown messages to nodes that are not part of the cluster
+ * or if we get multiple connections from a node.
+ */
static void sctp_send_shutdown(sctp_assoc_t associd)
{
static char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
if (!new_con)
return;
+ if (new_con->sock) {
+ log_print("reject connect from node %d: "
+ "already has a connection.",
+ nodeid);
+ sctp_send_shutdown(prim.ssp_assoc_id);
+ return;
+ }
+
/* Peel off a new sock */
lock_sock(con->sock->sk);
ret = sctp_do_peeloff(con->sock->sk,