diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2005-07-15 02:31:13 +0200 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2005-07-15 02:31:13 +0200 |
commit | fe2ace7a3bdfd372426ce450e9b48cb05fbec239 (patch) | |
tree | 14b28561d5aac2721339c084ac2bc410097a3aed /ndb/src/mgmapi | |
parent | 07d7567074f416eda5cdfe1068093648352ac0b3 (diff) | |
download | mariadb-git-fe2ace7a3bdfd372426ce450e9b48cb05fbec239.tar.gz |
merge, adopted structured event interface to filter out "PING" events c.f. BUG#11898, ndb_mgmd does not release resources
Diffstat (limited to 'ndb/src/mgmapi')
-rw-r--r-- | ndb/src/mgmapi/ndb_logevent.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/ndb/src/mgmapi/ndb_logevent.cpp b/ndb/src/mgmapi/ndb_logevent.cpp index 2817abcfdbb..4188929c952 100644 --- a/ndb/src/mgmapi/ndb_logevent.cpp +++ b/ndb/src/mgmapi/ndb_logevent.cpp @@ -369,6 +369,9 @@ int ndb_logevent_get_next(const NdbLogEventHandle h, Properties p; char buf[256]; + struct timeval start_time; + gettimeofday(&start_time, 0); + /* header */ while (1) { if (in.gets(buf,sizeof(buf)) == 0) @@ -383,7 +386,23 @@ int ndb_logevent_get_next(const NdbLogEventHandle h, } if ( strcmp("log event reply\n", buf) == 0 ) break; - ndbout_c("skipped: %s", buf); + + if ( strcmp("<PING>\n", buf) ) + ndbout_c("skipped: %s", buf); + + struct timeval now; + gettimeofday(&now, 0); + unsigned elapsed_ms= + (now.tv_sec-start_time.tv_sec)*1000 + + (now.tv_usec-start_time.tv_usec)/1000; + + if (elapsed_ms >= timeout_in_milliseconds) + { + // timed out + return 0; + } + + new (&in) SocketInputStream(h->socket, timeout_in_milliseconds-elapsed_ms); } /* read name-value pairs into properties object */ |