static struct vconn_class stream_vconn_class;
+static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(10, 25);
+
int
new_stream_vconn(const char *name, int fd, int connect_status,
uint32_t ip, struct vconn **vconnp)
struct ofp_header *oh = rx->data;
size_t length = ntohs(oh->length);
if (length < sizeof(struct ofp_header)) {
- VLOG_ERR("received too-short ofp_header (%zu bytes)", length);
+ VLOG_ERR_RL(&rl, "received too-short ofp_header (%zu bytes)",
+ length);
return EPROTO;
}
want_bytes = length - rx->size;
return EAGAIN;
} else if (retval == 0) {
if (rx->size) {
- VLOG_ERR("connection dropped mid-packet");
+ VLOG_ERR_RL(&rl, "connection dropped mid-packet");
return EPROTO;
} else {
return EOF;
ssize_t n = write(s->fd, s->txbuf->data, s->txbuf->size);
if (n < 0) {
if (errno != EAGAIN) {
- VLOG_ERR("send: %s", strerror(errno));
+ VLOG_ERR_RL(&rl, "send: %s", strerror(errno));
stream_clear_txbuf(s);
return;
}
if (new_fd < 0) {
int retval = errno;
if (retval != EAGAIN) {
- VLOG_DBG("accept: %s", strerror(retval));
+ VLOG_DBG_RL(&rl, "accept: %s", strerror(retval));
}
return retval;
}