@@ -514,10 +514,10 @@ public AssemblyInfo[] enumAssemblies () {
void collectAssemblyClasses (uint asmid, ref NCClassInfo[] clist) {
auto image = mono_assembly_get_image(cast(void*)asmid);
if (image is null) return;
- auto imgname = mono_image_get_name(image);
- if (imgname is null) return;
- scope(exit) g_free(imgname);
- auto imgnamestr = imgname.fromStringz.idup;
+ //auto imgname = mono_image_get_name(image);
+ //if (imgname is null) return;
+ //scope(exit) g_free(imgname);
+ //auto imgnamestr = imgname.fromStringz.idup;
auto tdef = mono_image_get_table_info(image, MONO_TABLE_TYPEDEF);
if (tdef is null) return;
auto tdefcount = mono_table_info_get_rows(tdef);
@@ -528,7 +528,7 @@ void collectAssemblyClasses (uint asmid, ref NCClassInfo[] clist) {
scope(exit) g_free(name);
auto nspace = mono_class_get_namespace(c);
scope(exit) if (nspace !is null) g_free(nspace);
- clist ~= NCClassInfo(cast(uint)c, asmid, imgnamestr, name.fromStringz.idup, nspace.fromStringz.idup);
+ clist ~= NCClassInfo(cast(uint)c, asmid, name.fromStringz.idup, nspace.fromStringz.idup);
}
}
@@ -64,10 +64,10 @@ struct AssemblyInfo {
struct NCClassInfo {
uint id;
uint asmid;
- string asmname;
string name;
string nspace;
// constructed
+ @NCIgnore string asmname;
@NCIgnore string fullname;
@NCIgnore string fullnamenoasm;
@@ -175,8 +175,16 @@ void monoScan () {
}
{
injSock.ncSendCommand(ReqCommand.MonoGetClasses);
+ injSock.resetBytesReceived;
injSock.ncReceiveReply(monoClasses);
+ writeln(injSock.bytesReceived, " bytes received");
foreach (ref cls; monoClasses) {
+ foreach (const ref ass; monoAsms) {
+ if (cls.asmid == ass.id) {
+ cls.asmname = ass.name;
+ break;
+ }
+ }
// build full name
cls.fullname = cls.asmname;
if (cls.nspace.length) { if (cls.fullname.length) cls.fullname ~= '.'; cls.fullname ~= cls.nspace; }
@@ -25,6 +25,8 @@ private:
static struct UDSData {
uint rc;
int fd;
+ uint bytesSent;
+ uint bytesReceived;
bool didlisten;
bool dontclose;
@disable this (this);
@@ -63,6 +65,12 @@ public:
void create (const(char)[] name) { doCC!"server"(name); }
void connect (const(char)[] name) { doCC!"client"(name); }
+ @property uint bytesSent () const nothrow @trusted @nogc { pragma(inline, true); return (udsp != 0 ? (cast(UDSData*)udsp).bytesSent : 0); }
+ @property uint bytesReceived () const nothrow @trusted @nogc { pragma(inline, true); return (udsp != 0 ? (cast(UDSData*)udsp).bytesReceived : 0); }
+
+ @property void resetBytesSent () nothrow @trusted @nogc { pragma(inline, true); if (udsp != 0) (cast(UDSData*)udsp).bytesSent = 0; }
+ @property void resetBytesReceived () nothrow @trusted @nogc { pragma(inline, true); if (udsp != 0) (cast(UDSData*)udsp).bytesReceived = 0; }
+
void listen () {
if (!udsp) throw new Exception("can't listen on closed socket");
auto uds = cast(UDSData*)udsp;
@@ -102,20 +110,8 @@ public:
if (buf.length == 0) return buf[];
auto rd = recv(uds.fd, buf.ptr, buf.length, 0);
if (rd < 0) throw new Exception("socket read error");
+ uds.bytesReceived += rd;
return buf[0..rd];
- /*
- auto uds = cast(UDSData*)udsp;
- auto dp = cast(ubyte*)buf.ptr;
- auto left = buf.length;
- while (left > 0) {
- auto rd = recv(uds.fd, dp, left, 0);
- if (rd == 0) break;
- if (rd < 0) throw new Exception("socket read error");
- dp += rd;
- left -= rd;
- }
- return buf[0..$-left];
- */
}
void rawWrite (const(void)[] buf) {
@@ -127,6 +123,7 @@ public:
while (left > 0) {
auto wr = send(uds.fd, dp, left, 0);
if (wr <= 0) throw new Exception("socket write error");
+ uds.bytesSent += wr;
dp += wr;
left -= wr;
}