websocketd: buffered read is not a problem anymore.
parent
3d0687554b
commit
209690d9e4
|
@ -154,7 +154,7 @@ def handle_new_clients(service, server)
|
||||||
# LibIPC.ipc_connection_switched service.pointer, req_service, client.fd, Pointer(Libc::Int).null
|
# LibIPC.ipc_connection_switched service.pointer, req_service, client.fd, Pointer(Libc::Int).null
|
||||||
LibIPC.ipc_connection_switched service.pointer, req_service, client.fd, pointerof (serverfd)
|
LibIPC.ipc_connection_switched service.pointer, req_service, client.fd, pointerof (serverfd)
|
||||||
|
|
||||||
proc_cb_in = ->ws_cb_in(Int32, Pointer(LibIPC::Message))
|
proc_cb_in = ->ws_cb_in(Int32, Pointer(LibIPC::Message), Int16*)
|
||||||
proc_cb_out = ->ws_cb_out(Int32, Pointer(LibIPC::Message))
|
proc_cb_out = ->ws_cb_out(Int32, Pointer(LibIPC::Message))
|
||||||
|
|
||||||
# 4. change client callbacks via ipc_switching_callbacks
|
# 4. change client callbacks via ipc_switching_callbacks
|
||||||
|
@ -191,7 +191,7 @@ rescue e
|
||||||
return LibIPC::IPCCB::Error
|
return LibIPC::IPCCB::Error
|
||||||
end
|
end
|
||||||
|
|
||||||
def ws_cb_in(fd : Int32, pm : LibIPC::Message*)
|
def ws_cb_in(fd : Int32, pm : LibIPC::Message*, more_to_read : Int16*)
|
||||||
info "IN fd is #{fd}"
|
info "IN fd is #{fd}"
|
||||||
|
|
||||||
wsclient = Context.context.fd_to_websocket[fd]
|
wsclient = Context.context.fd_to_websocket[fd]
|
||||||
|
@ -205,6 +205,12 @@ def ws_cb_in(fd : Int32, pm : LibIPC::Message*)
|
||||||
return LibIPC::IPCCB::Error
|
return LibIPC::IPCCB::Error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if wsclient.ws.io.empty?
|
||||||
|
more_to_read[0] = 0
|
||||||
|
else
|
||||||
|
more_to_read[0] = 1
|
||||||
|
end
|
||||||
|
|
||||||
if wsclient.closed?
|
if wsclient.closed?
|
||||||
info "#{CBLUE}client is closed#{CRESET}"
|
info "#{CBLUE}client is closed#{CRESET}"
|
||||||
Context.context.remove_fd fd
|
Context.context.remove_fd fd
|
||||||
|
|
Loading…
Reference in New Issue