|
|
@ -1,4 +1,4 @@
|
|
|
|
use crate::Result;
|
|
|
|
use crate::{Error, Result};
|
|
|
|
use anyhow::Context;
|
|
|
|
use anyhow::Context;
|
|
|
|
use jsonrpc_core as jsonrpc;
|
|
|
|
use jsonrpc_core as jsonrpc;
|
|
|
|
use log::{debug, error, info, warn};
|
|
|
|
use log::{debug, error, info, warn};
|
|
|
@ -76,14 +76,17 @@ impl Transport {
|
|
|
|
let mut content_length = None;
|
|
|
|
let mut content_length = None;
|
|
|
|
loop {
|
|
|
|
loop {
|
|
|
|
buffer.truncate(0);
|
|
|
|
buffer.truncate(0);
|
|
|
|
reader.read_line(buffer).await?;
|
|
|
|
if reader.read_line(buffer).await? == 0 {
|
|
|
|
let header = buffer.trim();
|
|
|
|
return Err(Error::StreamClosed);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// debug!("<- header {:?}", buffer);
|
|
|
|
|
|
|
|
|
|
|
|
if header.is_empty() {
|
|
|
|
if header.is_empty() {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
debug!("<- header {}", header);
|
|
|
|
let header = buffer.trim();
|
|
|
|
|
|
|
|
|
|
|
|
let parts = header.split_once(": ");
|
|
|
|
let parts = header.split_once(": ");
|
|
|
|
|
|
|
|
|
|
|
@ -121,8 +124,10 @@ impl Transport {
|
|
|
|
buffer: &mut String,
|
|
|
|
buffer: &mut String,
|
|
|
|
) -> Result<()> {
|
|
|
|
) -> Result<()> {
|
|
|
|
buffer.truncate(0);
|
|
|
|
buffer.truncate(0);
|
|
|
|
err.read_line(buffer).await?;
|
|
|
|
if err.read_line(buffer).await? == 0 {
|
|
|
|
error!("err <- {}", buffer);
|
|
|
|
return Err(Error::StreamClosed);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
error!("err <- {:?}", buffer);
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|