Index: pkg/dartino_agent/bin/agent.dart |
diff --git a/pkg/fletch_agent/bin/agent.dart b/pkg/dartino_agent/bin/agent.dart |
similarity index 91% |
rename from pkg/fletch_agent/bin/agent.dart |
rename to pkg/dartino_agent/bin/agent.dart |
index 1fcfa56ad792d710555b6359ece91086c17981cd..18394b32e6cae9a9dd342ce5ae4c92ad4c9215fd 100644 |
--- a/pkg/fletch_agent/bin/agent.dart |
+++ b/pkg/dartino_agent/bin/agent.dart |
@@ -2,17 +2,17 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE.md file. |
-library fletch_agent.agent; |
+library dartino_agent.agent; |
import 'dart:convert' show UTF8; |
-import 'dart:fletch'; |
-import 'dart:fletch.ffi'; |
-import 'dart:fletch.os' as os; |
+import 'dart:dartino'; |
+import 'dart:dartino.ffi'; |
+import 'dart:dartino.os' as os; |
import 'dart:typed_data'; |
import 'package:ffi/ffi.dart'; |
import 'package:file/file.dart'; |
-import 'package:fletch/fletch.dart' as fletch; |
+import 'package:dartino/dartino.dart' as dartino; |
import 'package:os/os.dart' show sys; |
import 'package:socket/socket.dart'; |
@@ -73,7 +73,7 @@ class AgentContext { |
final Logger logger; |
final bool applyUpgrade; |
- // Fletch-vm path and args. |
+ // Dartino-vm path and args. |
final String vmBinPath; |
final String vmLogDir; |
final String tmpDir; |
@@ -103,7 +103,7 @@ class AgentContext { |
'in the AGENT_PID_FILE environment variable.'); |
Process.exit(); |
} |
- String vmBinPath = _getEnv('FLETCH_VM'); |
+ String vmBinPath = _getEnv('DARTINO_VM'); |
String vmLogDir = _getEnv('VM_LOG_DIR'); |
String tmpDir = _getEnv('TMPDIR'); |
if (tmpDir == null) tmpDir = '/tmp'; |
@@ -117,9 +117,9 @@ class AgentContext { |
logger.info('Vm path: $vmBinPath'); |
logger.info('Log path: $vmLogDir'); |
- // Make sure we have a fletch-vm binary we can use for launching a vm. |
+ // Make sure we have a dartino-vm binary we can use for launching a vm. |
if (!File.existsAsFile(vmBinPath)) { |
- logger.error('Cannot find fletch vm at path: $vmBinPath'); |
+ logger.error('Cannot find dartino vm at path: $vmBinPath'); |
Process.exit(); |
} |
// Make sure we have a valid log directory. |
@@ -212,8 +212,8 @@ class CommandHandler { |
case RequestHeader.UPGRADE_AGENT: |
_upgradeAgent(); |
break; |
- case RequestHeader.FLETCH_VERSION: |
- _fletchVersion(); |
+ case RequestHeader.DARTINO_VERSION: |
+ _dartinoVersion(); |
break; |
case RequestHeader.SIGNAL_VM: |
_signalVm(); |
@@ -245,7 +245,7 @@ class CommandHandler { |
int port = _retrieveVmPort(portFile.path); |
reply = new StartVmReply( |
_requestHeader.id, ReplyHeader.SUCCESS, vmId: vmPid, vmPort: port); |
- _context.logger.info('Started fletch vm with pid $vmPid on port $port'); |
+ _context.logger.info('Started dartino vm with pid $vmPid on port $port'); |
} catch (e) { |
reply = new StartVmReply(_requestHeader.id, ReplyHeader.START_VM_FAILED); |
// TODO(wibling): could extend the result with caught error string. |
@@ -261,7 +261,7 @@ class CommandHandler { |
} |
int _retrieveVmPort(String portPath) { |
- // The fletch-vm will write the port it is listening on into the file |
+ // The dartino-vm will write the port it is listening on into the file |
// specified by 'portPath' above. The agent waits for the file to be |
// created (retries the File.open until it succeeds) and then reads the |
// port from the file. |
@@ -270,9 +270,9 @@ class CommandHandler { |
// reading the value from the file until we have read the same value from |
// file in two consecutive reads. |
// An alternative to the consecutive reading would be to use cooperative |
- // locking, but consecutive reading is not relying on the fletch-vm to |
+ // locking, but consecutive reading is not relying on the dartino-vm to |
// behave. |
- // TODO(wibling): Look into passing a socket port to the fletch-vm and |
+ // TODO(wibling): Look into passing a socket port to the dartino-vm and |
// have it write the port to the socket. This allows the agent to just |
// wait on the socket and wake up when it is ready. |
int previousPort = -1; |
@@ -321,7 +321,7 @@ class CommandHandler { |
var pidBytes = _socket.read(4); |
if (pidBytes == null) { |
reply = new StopVmReply(_requestHeader.id, ReplyHeader.INVALID_PAYLOAD); |
- _context.logger.warn('Missing pid of the fletch vm to stop.'); |
+ _context.logger.warn('Missing pid of the dartino vm to stop.'); |
} else { |
int pid = readUint32(pidBytes, 0); |
int err = _kill.icall$2(pid, SIGTERM); |
@@ -348,7 +348,7 @@ class CommandHandler { |
var pidBytes = _socket.read(8); |
if (pidBytes == null) { |
reply = new SignalVmReply(_requestHeader.id, ReplyHeader.INVALID_PAYLOAD); |
- _context.logger.warn('Missing pid of the fletch vm to signal.'); |
+ _context.logger.warn('Missing pid of the dartino vm to signal.'); |
} else { |
int pid = readUint32(pidBytes, 0); |
int signal = readUint32(pidBytes, 4); |
@@ -382,11 +382,11 @@ class CommandHandler { |
int result; |
ByteBuffer binary = _socket.read(_requestHeader.payloadLength); |
if (binary == null) { |
- _context.logger.warn('Could not read fletch-agent package binary' |
+ _context.logger.warn('Could not read dartino-agent package binary' |
' of length ${_requestHeader.payloadLength} bytes'); |
result = ReplyHeader.INVALID_PAYLOAD; |
} else { |
- _context.logger.info('Read fletch-agent package binary' |
+ _context.logger.info('Read dartino-agent package binary' |
' of length ${binary.lengthInBytes} bytes.'); |
File file = new File.open(PACKAGE_FILE_NAME, mode: File.WRITE); |
try { |
@@ -414,10 +414,10 @@ class CommandHandler { |
_sendReply(new UpgradeAgentReply(_requestHeader.id, result)); |
} |
- void _fletchVersion() { |
- String version = fletch.version(); |
- _context.logger.info('Returning fletch version $version'); |
- _sendReply(new FletchVersionReply( |
+ void _dartinoVersion() { |
+ String version = dartino.version(); |
+ _context.logger.info('Returning dartino version $version'); |
+ _sendReply(new DartinoVersionReply( |
_requestHeader.id, ReplyHeader.SUCCESS, version: version)); |
} |
} |
@@ -429,7 +429,7 @@ void main(List<String> arguments) { |
// Write the program's pid to the pid file if set. |
_writePid(context.pidFile); |
- // Run fletch agent on given ip address and port. |
+ // Run dartino agent on given ip address and port. |
var agent = new Agent(context); |
agent.start(); |
} |
@@ -450,13 +450,13 @@ void _writePid(String pidFilePath) { |
void printUsage() { |
print('Usage:'); |
- print('The Fletch agent supports the following flags'); |
+ print('The Dartino agent supports the following flags'); |
print(''); |
print(' --port: specify the port on which to listen, default: ' |
'$AGENT_DEFAULT_PORT'); |
print(' --ip: specify the ip address on which to listen, default: 0.0.0.0'); |
print(' --vm: specify the path to the vm binary, default: ' |
- '/opt/fletch/bin/fletch-vm.'); |
+ '/opt/dartino/bin/dartino-vm.'); |
print(''); |
Process.exit(); |
} |