Unverified Commit fd72cdc0 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #61 from libp2p/fix/disable-write-coalescing

disable write coalescing
parents 8df7f3d7 e636aee8
...@@ -192,7 +192,11 @@ func (mp *Multiplex) handleOutgoing() { ...@@ -192,7 +192,11 @@ func (mp *Multiplex) handleOutgoing() {
return return
case data := <-mp.writeCh: case data := <-mp.writeCh:
err := mp.writeMsg(data) // FIXME: https://github.com/libp2p/go-libp2p/issues/644
// write coalescing disabled until this can be fixed.
//err := mp.writeMsg(data)
err := mp.doWriteMsg(data)
pool.Put(data)
if err != nil { if err != nil {
// the connection is closed by this time // the connection is closed by this time
log.Warningf("error writing data: %s", err.Error()) log.Warningf("error writing data: %s", err.Error())
...@@ -204,7 +208,9 @@ func (mp *Multiplex) handleOutgoing() { ...@@ -204,7 +208,9 @@ func (mp *Multiplex) handleOutgoing() {
func (mp *Multiplex) writeMsg(data []byte) error { func (mp *Multiplex) writeMsg(data []byte) error {
if len(data) >= 512 { if len(data) >= 512 {
return mp.doWriteMsg(data) err := mp.doWriteMsg(data)
pool.Put(data)
return err
} }
buf := pool.Get(4096) buf := pool.Get(4096)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment