Fixes close() call on websockets.
parent
a5e2e8f340
commit
2ddcdfb27b
70
Makefile
70
Makefile
|
@ -1,5 +1,5 @@
|
|||
PACKAGE = 'plumberd'
|
||||
VERSION = '0.1.0'
|
||||
PACKAGE = 'ipcd'
|
||||
VERSION = '0.2.1'
|
||||
|
||||
PREFIX := /usr/local
|
||||
BINDIR := $(PREFIX)/bin
|
||||
|
@ -8,13 +8,19 @@ SHAREDIR := $(PREFIX)/share
|
|||
INCLUDEDIR := $(PREFIX)/include
|
||||
MANDIR := $(SHAREDIR)/man
|
||||
CRFLAGS := --release
|
||||
CRFLAGS := --release
|
||||
CRFLAGS := --release
|
||||
CRFLAGS := --release
|
||||
CRFLAGS := --release
|
||||
CRFLAGS := --release
|
||||
CRFLAGS := --release
|
||||
|
||||
Q := @
|
||||
|
||||
all: tcpd tcpc pongd pongc plumberd websocketc websocketd
|
||||
all: tcpd tcpc pongd pongc ipcd websocketc websocketd
|
||||
@:
|
||||
|
||||
tcpd: src/tcpd.cr
|
||||
tcpd: src/tcpd.cr
|
||||
@echo '[01;35m CR > [01;37mtcpd[00m'
|
||||
$(Q)crystal build $(CRFLAGS) src/tcpd.cr -o 'tcpd'
|
||||
|
||||
|
@ -32,7 +38,7 @@ tcpd.uninstall:
|
|||
@echo '[01;37m RM > [01;37m$(BINDIR)/tcpd[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/tcpd'
|
||||
|
||||
tcpc: src/tcpc.cr
|
||||
tcpc: src/tcpc.cr
|
||||
@echo '[01;35m CR > [01;37mtcpc[00m'
|
||||
$(Q)crystal build $(CRFLAGS) src/tcpc.cr -o 'tcpc'
|
||||
|
||||
|
@ -50,7 +56,7 @@ tcpc.uninstall:
|
|||
@echo '[01;37m RM > [01;37m$(BINDIR)/tcpc[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/tcpc'
|
||||
|
||||
pongd: src/pongd.cr
|
||||
pongd: src/pongd.cr
|
||||
@echo '[01;35m CR > [01;37mpongd[00m'
|
||||
$(Q)crystal build $(CRFLAGS) src/pongd.cr -o 'pongd'
|
||||
|
||||
|
@ -68,7 +74,7 @@ pongd.uninstall:
|
|||
@echo '[01;37m RM > [01;37m$(BINDIR)/pongd[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/pongd'
|
||||
|
||||
pongc: src/pongc.cr
|
||||
pongc: src/pongc.cr
|
||||
@echo '[01;35m CR > [01;37mpongc[00m'
|
||||
$(Q)crystal build $(CRFLAGS) src/pongc.cr -o 'pongc'
|
||||
|
||||
|
@ -86,25 +92,25 @@ pongc.uninstall:
|
|||
@echo '[01;37m RM > [01;37m$(BINDIR)/pongc[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/pongc'
|
||||
|
||||
plumberd: src/plumberd.cr
|
||||
@echo '[01;35m CR > [01;37mplumberd[00m'
|
||||
$(Q)crystal build $(CRFLAGS) src/plumberd.cr -o 'plumberd'
|
||||
ipcd: src/ipcd.cr
|
||||
@echo '[01;35m CR > [01;37mipcd[00m'
|
||||
$(Q)crystal build $(CRFLAGS) src/ipcd.cr -o 'ipcd'
|
||||
|
||||
|
||||
plumberd.install: plumberd
|
||||
@echo '[01;31m IN > [01;37m$(BINDIR)/plumberd[00m'
|
||||
ipcd.install: ipcd
|
||||
@echo '[01;31m IN > [01;37m$(BINDIR)/ipcd[00m'
|
||||
$(Q)mkdir -p '$(DESTDIR)$(BINDIR)'
|
||||
$(Q)install -m0755 plumberd $(DESTDIR)$(BINDIR)/plumberd
|
||||
$(Q)install -m0755 ipcd $(DESTDIR)$(BINDIR)/ipcd
|
||||
|
||||
plumberd.clean:
|
||||
@echo '[01;37m RM > [01;37mplumberd[00m'
|
||||
$(Q)rm -f plumberd
|
||||
ipcd.clean:
|
||||
@echo '[01;37m RM > [01;37mipcd[00m'
|
||||
$(Q)rm -f ipcd
|
||||
|
||||
plumberd.uninstall:
|
||||
@echo '[01;37m RM > [01;37m$(BINDIR)/plumberd[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/plumberd'
|
||||
ipcd.uninstall:
|
||||
@echo '[01;37m RM > [01;37m$(BINDIR)/ipcd[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/ipcd'
|
||||
|
||||
websocketc: src/websocketc.cr
|
||||
websocketc: src/websocketc.cr
|
||||
@echo '[01;35m CR > [01;37mwebsocketc[00m'
|
||||
$(Q)crystal build $(CRFLAGS) src/websocketc.cr -o 'websocketc'
|
||||
|
||||
|
@ -122,7 +128,7 @@ websocketc.uninstall:
|
|||
@echo '[01;37m RM > [01;37m$(BINDIR)/websocketc[00m'
|
||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/websocketc'
|
||||
|
||||
websocketd: src/websocketd.cr
|
||||
websocketd: src/websocketd.cr
|
||||
@echo '[01;35m CR > [01;37mwebsocketd[00m'
|
||||
$(Q)crystal build $(CRFLAGS) src/websocketd.cr -o 'websocketd'
|
||||
|
||||
|
@ -158,13 +164,13 @@ $(DESTDIR)$(INCLUDEDIR):
|
|||
$(DESTDIR)$(MANDIR):
|
||||
@echo '[01;35m DIR > [01;37m$(MANDIR)[00m'
|
||||
$(Q)mkdir -p $(DESTDIR)$(MANDIR)
|
||||
install: tcpd.install tcpc.install pongd.install pongc.install plumberd.install websocketc.install websocketd.install
|
||||
install: tcpd.install tcpc.install pongd.install pongc.install ipcd.install websocketc.install websocketd.install
|
||||
@:
|
||||
|
||||
uninstall: tcpd.uninstall tcpc.uninstall pongd.uninstall pongc.uninstall plumberd.uninstall websocketc.uninstall websocketd.uninstall
|
||||
uninstall: tcpd.uninstall tcpc.uninstall pongd.uninstall pongc.uninstall ipcd.uninstall websocketc.uninstall websocketd.uninstall
|
||||
@:
|
||||
|
||||
clean: tcpd.clean tcpc.clean pongd.clean pongc.clean plumberd.clean websocketc.clean websocketd.clean
|
||||
clean: tcpd.clean tcpc.clean pongd.clean pongc.clean ipcd.clean websocketc.clean websocketd.clean
|
||||
distclean: clean
|
||||
dist: dist-gz dist-xz dist-bz2
|
||||
$(Q)rm -- $(PACKAGE)-$(VERSION)
|
||||
|
@ -182,8 +188,8 @@ $(PACKAGE)-$(VERSION).tar.gz: distdir
|
|||
$(PACKAGE)-$(VERSION)/src/tcpc.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/pongc.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/tcpd.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/plumberd.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/pongd.cr
|
||||
$(PACKAGE)-$(VERSION)/src/pongd.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/ipcd.cr
|
||||
|
||||
dist-xz: $(PACKAGE)-$(VERSION).tar.xz
|
||||
$(PACKAGE)-$(VERSION).tar.xz: distdir
|
||||
|
@ -194,8 +200,8 @@ $(PACKAGE)-$(VERSION).tar.xz: distdir
|
|||
$(PACKAGE)-$(VERSION)/src/tcpc.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/pongc.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/tcpd.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/plumberd.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/pongd.cr
|
||||
$(PACKAGE)-$(VERSION)/src/pongd.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/ipcd.cr
|
||||
|
||||
dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2
|
||||
$(PACKAGE)-$(VERSION).tar.bz2: distdir
|
||||
|
@ -206,11 +212,11 @@ $(PACKAGE)-$(VERSION).tar.bz2: distdir
|
|||
$(PACKAGE)-$(VERSION)/src/tcpc.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/pongc.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/tcpd.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/plumberd.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/pongd.cr
|
||||
$(PACKAGE)-$(VERSION)/src/pongd.cr \
|
||||
$(PACKAGE)-$(VERSION)/src/ipcd.cr
|
||||
|
||||
help:
|
||||
@echo '[01;37m :: plumberd-0.1.0[00m'
|
||||
@echo '[01;37m :: ipcd-0.2.1[00m'
|
||||
@echo ''
|
||||
@echo '[01;37mGeneric targets:[00m'
|
||||
@echo '[00m - [01;32mhelp [37m Prints this help message.[00m'
|
||||
|
@ -240,7 +246,7 @@ help:
|
|||
@echo ' - [01;33mtcpc [37m crystal[00m'
|
||||
@echo ' - [01;33mpongd [37m crystal[00m'
|
||||
@echo ' - [01;33mpongc [37m crystal[00m'
|
||||
@echo ' - [01;33mplumberd [37m crystal[00m'
|
||||
@echo ' - [01;33mipcd [37m crystal[00m'
|
||||
@echo ' - [01;33mwebsocketc [37m crystal[00m'
|
||||
@echo ' - [01;33mwebsocketd [37m crystal[00m'
|
||||
@echo ''
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package=ipcd
|
||||
version=0.2.0
|
||||
version=0.2.1
|
||||
|
||||
targets=(tcpd tcpc pongd pongc ipcd websocketc websocketd)
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ class HTTP::WebSocket
|
|||
@current_message.write @buffer[0, info.size]
|
||||
if info.final
|
||||
message = @current_message.to_s
|
||||
@on_close.try &.call(message)
|
||||
close(message) unless closed?
|
||||
@on_close.try &.call(HTTP::WebSocket::CloseCode::NormalClosure, message)
|
||||
close(HTTP::WebSocket::CloseCode::NormalClosure, message) unless closed?
|
||||
@current_message.clear
|
||||
return Close.new
|
||||
end
|
||||
|
|
Reference in New Issue