// create file called "X.[messageid].msg" located in the store // the contents of the file is the bytes of the message // if a message with m's message id already exists, it will // be overwritten // X will be 'i' for inbound messages, and O for outbound messages func write(store, key string, m packets.ControlPacket) { filepath := fullpath(store, key) f, err := os.Create(filepath) chkerr(err) werr := m.Write(f) chkerr(werr) cerr := f.Close() chkerr(cerr) }