Skip to content

Commit

Permalink
undo formatting; fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rawhat committed May 27, 2024
1 parent 1a5b580 commit 7d9cdec
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 25 deletions.
14 changes: 7 additions & 7 deletions examples/complete/src/complete.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ const index = "<html lang='en'>

pub fn main() {
logging.configure()
logger_update_primary_config(
dict.from_list([
#(atom.create_from_string("level"), atom.create_from_string("debug")),
]),
)
let _ =
logger_update_primary_config(
dict.from_list([
#(atom.create_from_string("level"), atom.create_from_string("debug")),
]),
)
// These values are for the Websocket process initialized below
let selector = process.new_selector()
let state = Nil
Expand Down Expand Up @@ -80,8 +81,7 @@ fn handle_ws_message(state, conn, message) {
let assert Ok(_) = mist.send_text_frame(conn, "pong")
actor.continue(state)
}
mist.Text(_)
| mist.Binary(_) -> {
mist.Text(_) | mist.Binary(_) -> {
actor.continue(state)
}
mist.Custom(Broadcast(text)) -> {
Expand Down
7 changes: 2 additions & 5 deletions src/mist/internal/http.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ fn read_chunk(
}
}
}
<<>> as data, _
| data, Error(Nil) -> {
<<>> as data, _ | data, Error(Nil) -> {
use next <- result.then(read_data(
socket,
transport,
Expand Down Expand Up @@ -383,9 +382,7 @@ pub fn read_body(
data: data,
remaining: remaining,
attempts: attempts,
)
if remaining > 0
-> {
) if remaining > 0 -> {
let res =
selector
|> process.select(1000)
Expand Down
4 changes: 1 addition & 3 deletions src/mist/internal/http/handler.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ fn log_and_error(
req: Request(Connection),
) -> process.ExitReason {
case error {
Exited(msg)
| Thrown(msg)
| Errored(msg) -> {
Exited(msg) | Thrown(msg) | Errored(msg) -> {
logging.log(logging.Error, string.inspect(error))
let _ =
response.new(500)
Expand Down
16 changes: 6 additions & 10 deletions src/mist/internal/http2.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,12 @@ pub fn send_bytes_builder(
0 -> send_headers(context, conn, headers, True, id)
_ -> {
send_headers(context, conn, headers, False, id)
|> result.then(
fn(
context,
// TODO: this should be broken up by window size
// TODO: fix end_stream
) {
send_data(conn, bytes_builder.to_bit_array(resp.body), id, True)
|> result.replace(context)
},
)
|> result.then(fn(context) {
// TODO: this should be broken up by window size
// TODO: fix end_stream
send_data(conn, bytes_builder.to_bit_array(resp.body), id, True)
|> result.replace(context)
})
}
}
}
Expand Down

0 comments on commit 7d9cdec

Please sign in to comment.