add message terminator (newline) to socket writer output to ease client integration
This commit is contained in:
parent
c55ada2f26
commit
106645d9bd
|
@ -47,10 +47,13 @@ pub struct EntrySocket {
|
|||
socket: String,
|
||||
}
|
||||
|
||||
const MESSAGE_TERMINATOR: &str = "\n";
|
||||
|
||||
impl EntryWriter for EntrySocket {
|
||||
fn write(&self, payload: String) -> Result<()> {
|
||||
let mut socket = UnixStream::connect(Path::new(&self.socket))?;
|
||||
socket.write_all(payload.as_bytes())?;
|
||||
socket.write_all(MESSAGE_TERMINATOR.as_bytes())?;
|
||||
socket.shutdown(Shutdown::Write)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue