Merge 2.3 into 2.4-pr
This commit is contained in:
commit
ab4ce41015
@ -35,10 +35,6 @@ namespace IW4MAdmin.Application.IO
|
||||
|
||||
public async Task<ICollection<GameEvent>> ReadEventsFromLog(Server server, long fileSizeDiff, long startPosition)
|
||||
{
|
||||
#if DEBUG == true
|
||||
server.Logger.WriteDebug($"Begin reading from http log at {DateTime.Now.Millisecond}");
|
||||
#endif
|
||||
|
||||
if (!ignoreBots.HasValue)
|
||||
{
|
||||
ignoreBots = server.Manager.GetApplicationSettings().Configuration().IgnoreBots;
|
||||
@ -55,8 +51,11 @@ namespace IW4MAdmin.Application.IO
|
||||
return events;
|
||||
}
|
||||
|
||||
else if (response.Data != null)
|
||||
else if (!string.IsNullOrWhiteSpace(response.Data))
|
||||
{
|
||||
#if DEBUG
|
||||
server.Manager.GetLogger(0).WriteInfo(response.Data);
|
||||
#endif
|
||||
// parse each line
|
||||
foreach (string eventLine in response.Data.Split(Environment.NewLine))
|
||||
{
|
||||
@ -116,9 +115,6 @@ namespace IW4MAdmin.Application.IO
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG == true
|
||||
server.Logger.WriteDebug($"End reading from http log at {DateTime.Now.Millisecond}");
|
||||
#endif
|
||||
return events;
|
||||
}
|
||||
}
|
||||
|
@ -39,50 +39,43 @@ class LogReader(object):
|
||||
|
||||
next_retrieval_key = self._generate_key()
|
||||
|
||||
#print('next key is %s' % next_retrieval_key)
|
||||
|
||||
# this is the first time the key has been requested, so we need to the next one
|
||||
if retrieval_key not in self.log_file_sizes:
|
||||
print ('requested key %s does not exist' % retrieval_key)
|
||||
self.log_file_sizes[next_retrieval_key] = {
|
||||
'size': new_file_size,
|
||||
'length': 0,
|
||||
'read': time.time(),
|
||||
'next_key': next_retrieval_key, # the key that IW4MAdmin should request next
|
||||
'previous_key': retrieval_key # the old key that can be deleted next
|
||||
}
|
||||
return {
|
||||
'content': None,
|
||||
'next_key': next_retrieval_key
|
||||
print('retrieval key "%s" does not exist' % retrieval_key)
|
||||
last_log_info = {
|
||||
'size' : new_file_size,
|
||||
'previous_key' : None
|
||||
}
|
||||
else:
|
||||
current_log_info = self.log_file_sizes[retrieval_key]
|
||||
last_log_info = self.log_file_sizes[retrieval_key]
|
||||
|
||||
# grab the previous values
|
||||
last_length = current_log_info['length']
|
||||
last_size = current_log_info['size']
|
||||
print('next key is %s' % next_retrieval_key)
|
||||
expired_key = last_log_info['previous_key']
|
||||
print('expired key is %s' % expired_key)
|
||||
|
||||
# grab the previous value
|
||||
last_size = last_log_info['size']
|
||||
file_size_difference = new_file_size - last_size
|
||||
|
||||
#print('generating info for next key %s' % next_retrieval_key)
|
||||
|
||||
# update the new size and actually read the data
|
||||
# update the new size
|
||||
self.log_file_sizes[next_retrieval_key] = {
|
||||
'size' : new_file_size,
|
||||
'length': last_length,
|
||||
'read': time.time(),
|
||||
'next_key': next_retrieval_key,
|
||||
'previous_key': retrieval_key
|
||||
}
|
||||
|
||||
if current_log_info['previous_key'] in self.log_file_sizes.keys():
|
||||
#print('deleting old key %s' % current_log_info['previous_key'])
|
||||
del self.log_file_sizes[current_log_info['previous_key']]
|
||||
if expired_key in self.log_file_sizes:
|
||||
print('deleting expired key %s' % expired_key)
|
||||
del self.log_file_sizes[expired_key]
|
||||
|
||||
#print('reading %i bytes starting at %i' % (file_size_difference, last_size))
|
||||
|
||||
new_log_info = self.get_file_lines(path, last_size, file_size_difference)
|
||||
new_log_content = self.get_file_lines(path, last_size, file_size_difference)
|
||||
return {
|
||||
'content': new_log_info,
|
||||
'content': new_log_content,
|
||||
'next_key': next_retrieval_key
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,12 @@ var plugin = {
|
||||
// connect or join event
|
||||
if (gameEvent.Type === 3) {
|
||||
// this GUID seems to have been packed in a IW4 torrent and results in an unreasonable amount of people using the same GUID
|
||||
if (gameEvent.Origin.NetworkId === -805366929435212061 || gameEvent.Origin.NetworkId == -3304388024725980231) {
|
||||
if (gameEvent.Origin.NetworkId === -805366929435212061 ||
|
||||
gameEvent.Origin.NetworkId === 3150799945255696069 ||
|
||||
gameEvent.Origin.NetworkId === 5859032128210324569 ||
|
||||
gameEvent.Origin.NetworkId === 2908745942105435771 ||
|
||||
gameEvent.Origin.NetworkId === -6492697076432899192 ||
|
||||
gameEvent.Origin.NetworkId === 3304388024725980231) {
|
||||
gameEvent.Origin.Kick('Your GUID is generic. Delete players/guids.dat and rejoin', _IW4MAdminClient);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user