diff --git a/contrib/backends/nntpchan-daemon/libnntpchan/kqueue.hpp b/contrib/backends/nntpchan-daemon/libnntpchan/kqueue.hpp index decf970..0ef54ae 100644 --- a/contrib/backends/nntpchan-daemon/libnntpchan/kqueue.hpp +++ b/contrib/backends/nntpchan-daemon/libnntpchan/kqueue.hpp @@ -1,4 +1,5 @@ #include +#include #include namespace nntpchan @@ -24,7 +25,7 @@ namespace ev virtual bool TrackConn(ev::io * handler) { - kevent event; + struct kevent event; short filter = 0; if(handler->readable() || handler->acceptable()) { @@ -48,7 +49,7 @@ namespace ev virtual void UntrackConn(ev::io * handler) { - kevent event; + struct kevent event; short filter = 0; if(handler->readable() || handler->acceptable()) { @@ -60,8 +61,7 @@ namespace ev } EV_SET(&event, handler->fd, filter, EV_DELETE, 0, 0, handler); int ret = kevent(kfd, &event, 1, nullptr, 0, nullptr); - if(ret == -1) return false; - if(event.flags & EV_ERROR) + if(ret == -1 || event.flags & EV_ERROR) { std::cerr << "KqueueLoop::UntrackConn() kevent failed: " << strerror(event.data) << std::endl; return false; @@ -72,8 +72,8 @@ namespace ev virtual void Run() { - kevent events[512]; - kevent * ev; + struct kevent events[512]; + struct kevent * event; io * handler; int ret, idx; do @@ -84,17 +84,17 @@ namespace ev { while(idx < ret) { - ev = &events[idx++]; + event = &events[idx++]; handler = static_cast(ev->udata); - if(ev->flags & EV_EOF) + if(event->flags & EV_EOF) { handler->close(); delete handler; continue; } - if(ev->filter & EVFILT_READ && handler->acceptable()) + if(event->filter & EVFILT_READ && handler->acceptable()) { - int backlog = ev->data; + int backlog = event->data; while(backlog) { handler->accept(); @@ -102,10 +102,10 @@ namespace ev } } - if(ev->filter & EVFILT_READ && handler->readable()) + if(event->filter & EVFILT_READ && handler->readable()) { int readed = 0; - int readnum = ev->data; + int readnum = event->data; while(readnum > sizeof(readbuf)) { int r = handler->read(readbuf, sizeof(readbuf)); @@ -126,9 +126,9 @@ namespace ev readed = r; } } - if(ev->filter & EVFILT_WRITE && handler->writable()) + if(event->filter & EVFILT_WRITE && handler->writeable()) { - int writespace = ev->data; + int writespace = event->data; int written = handler->write(writespace); if(written > 0) { diff --git a/contrib/backends/srndv2/Makefile b/contrib/backends/srndv2/Makefile index 067b1bf..bd3908e 100644 --- a/contrib/backends/srndv2/Makefile +++ b/contrib/backends/srndv2/Makefile @@ -2,13 +2,15 @@ GOROOT ?= $(shell go env GOROOT) GO ?= $(GOROOT)/bin/go REPO=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) VERSION=$(shell $(GO) version | cut -d' ' -f3) - +GOARCH ?= $(shell go env GOARCH) +GOOS ?= $(shell go env GOOS) +GOARM ?= $(shell go env GOARM) all: build build: srndv2 srndv2: - GOPATH=$(REPO) GOROOT=$(GOROOT) $(GO) build -ldflags "-X srnd.GitVersion=-$(shell git rev-parse --short HEAD)" -v + GOARM=$(GOARM) GOOS=$(GOOS) GOARCH=$(GOARCH) GOPATH=$(REPO) GOROOT=$(GOROOT) $(GO) build -ldflags "-X srnd.GitVersion=-$(shell git rev-parse --short HEAD)" -v srndv2-lua: GOPATH=$(REPO) GOROOT=$(GOROOT) $(GO) build -ldflags "-X srnd.GitVersion=-$(shell git rev-parse --short HEAD)" -tags lua -v