| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // Mutex-protected encoder and decoder pair |
| func newEncDec(conn net.Conn) *encDec { |
| dec: gob.NewDecoder(conn), |
| enc: gob.NewEncoder(conn), |
| func (ed *encDec) decode(e interface{}) os.Error { |
| defer ed.decLock.Unlock() |
| log.Stderr("exporter decode:", err) |
| // TODO: tear down connection |
| func (ed *encDec) encode(e0, e1 interface{}) os.Error { |
| defer ed.encLock.Unlock() |
| if err == nil && e1 != nil { |
| log.Stderr("exporter encode:", err) |
| // TODO: tear down connection? |