diff options
author | Ben Pfaff <blp@ovn.org> | 2018-08-20 16:08:09 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-08-20 20:27:23 -0700 |
commit | aeada0eaecabb847bad2c4a2cc821c4bcb8b3dd8 (patch) | |
tree | eb942fae5f4020630228e3eaa4a5a805b5d4aa2b /lib/socket-util.c | |
parent | 1bab4901c45c9c7b0121836ccb2aa2b004a0cfd6 (diff) | |
download | openvswitch-aeada0eaecabb847bad2c4a2cc821c4bcb8b3dd8.tar.gz |
socket-util: Rate limit logs for bind attempts.
This reduces the amount of logging when higher-level code retries binding
ports that are in use.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
Diffstat (limited to 'lib/socket-util.c')
-rw-r--r-- | lib/socket-util.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/socket-util.c b/lib/socket-util.c index 504f4cd59..df9b01a9e 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -725,7 +725,8 @@ inet_open_passive(int style, const char *target, int default_port, /* Bind. */ if (bind(fd, (struct sockaddr *) &ss, ss_length(&ss)) < 0) { error = sock_errno(); - VLOG_ERR("%s: bind: %s", target, sock_strerror(error)); + static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); + VLOG_ERR_RL(&rl, "%s: bind: %s", target, sock_strerror(error)); goto error; } |