From 1837aa191511507ef05d08b9c0400c61feae6b18 Mon Sep 17 00:00:00 2001 From: Daniel Collins Date: Wed, 14 Nov 2018 01:33:35 +0000 Subject: [PATCH] Misc. fixes - Honour DPNSEND_NOCOMPLETE flag to IDirectPlay8Peer::SendTo() - Allow calling IDirectPlay8Peer::GetGroupInfo() in more states so that it can be called when processing DPNMSG_GROUP_CREATE during connection. - Don't buffer log messages. --- src/DirectPlay8Peer.cpp | 19 +++++++++++-------- src/Log.cpp | 4 ++++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/DirectPlay8Peer.cpp b/src/DirectPlay8Peer.cpp index 9c31848..d4f5a71 100644 --- a/src/DirectPlay8Peer.cpp +++ b/src/DirectPlay8Peer.cpp @@ -789,9 +789,12 @@ HRESULT DirectPlay8Peer::SendTo(CONST DPNID dpnid, CONST DPN_BUFFER_DESC* CONST delete result; delete pending; - l.unlock(); - message_handler(message_handler_ctx, DPN_MSGID_SEND_COMPLETE, &sc); - l.lock(); + if(!(dwFlags & DPNSEND_NOCOMPLETE)) + { + l.unlock(); + message_handler(message_handler_ctx, DPN_MSGID_SEND_COMPLETE, &sc); + l.lock(); + } } }; @@ -1967,12 +1970,12 @@ HRESULT DirectPlay8Peer::GetGroupInfo(CONST DPNID dpnid, DPN_GROUP_INFO* CONST p case STATE_NEW: return DPNERR_UNINITIALIZED; case STATE_INITIALISED: return DPNERR_NOCONNECTION; case STATE_HOSTING: break; - case STATE_CONNECTING_TO_HOST: return DPNERR_CONNECTING; - case STATE_CONNECTING_TO_PEERS: return DPNERR_CONNECTING; - case STATE_CONNECT_FAILED: return DPNERR_CONNECTING; + case STATE_CONNECTING_TO_HOST: break; + case STATE_CONNECTING_TO_PEERS: break; + case STATE_CONNECT_FAILED: break; case STATE_CONNECTED: break; - case STATE_CLOSING: return DPNERR_CONNECTIONLOST; - case STATE_TERMINATED: return DPNERR_CONNECTIONLOST; + case STATE_CLOSING: break; + case STATE_TERMINATED: break; } Group *group = get_group_by_id(dpnid); diff --git a/src/Log.cpp b/src/Log.cpp index 11fc066..971adce 100644 --- a/src/Log.cpp +++ b/src/Log.cpp @@ -23,6 +23,10 @@ static void _log_init() if(log_name != NULL) { log_fh = fopen(log_name, "a"); + if(log_fh != NULL) + { + setbuf(log_fh, NULL); + } } const char *t = getenv("DPLITE_TRACE");