NTCP: Don't write to an inbound connection before established, causing NPE (ticket #996)

This commit is contained in:
zzz
2017-02-05 19:09:12 +00:00
parent aa098ac800
commit afb87cd75c

View File

@@ -791,9 +791,11 @@ class NTCPConnection implements Closeable {
private void prepareNextWriteFast(PrepBuffer buf) {
if (_closed.get())
return;
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("prepare next write w/ isInbound? " + _isInbound + " established? " + _established);
if (!_isInbound && !isEstablished()) {
// Must be established or else session key is null and we can't encrypt
// This is normal for OB conns but can happen rarely for IB also.
// wantsWrite() is called at end of OB establishment, and
// enqueueInfoMessage() is called at end of IB establishment.
if (!isEstablished()) {
return;
}