/** @syncpriority 200 */ public void notifyDeadConnection(ConnectionPair pair) { synchronized (this) { streamConns.removeConnectionPair(pair); if (pair instanceof LCPair) { prm.notifyDeadConnection(pair.getCC().getNodeId()); if (streamConns.getNumListenConns() < mina.getConfig().getMaxSources()) requestCachedSources(); bidStrategy.cleanup(pair.getCC().getNodeId()); // Make note of them in case they come back LCPair lcp = (LCPair) pair; SourceStatus sourceStat = lcp.getLastSourceStatus(); if (sourceStat != null) { StreamStatus streamStat = lcp.getLastStreamStatus(); if (streamStat == null) throw new SeekInnerCalmException(); mina.getSourceMgr().cachePossiblyDeadSource(sourceStat, streamStat); } } if (streamConns.getNumBroadcastConns() == 0 && streamConns.getNumListenConns() == 0) { try { pageBuf.sleep(); } catch (IOException e) { log.error("Error sleeping page buffer", e); stop(); } } } if (isReceiving()) mina.getEventMgr().fireReceptionConnsChanged(streamId); }
/** @syncpriority 200 */ public void receivePage(Page p) { synchronized (this) { // We might have already stopped receiving, in which case the // pagebuf will be closed if (!isReceiving()) return; try { pageBuf.putPage(p); } catch (IOException e) { log.error("Error putting page into buffer", e); stop(); return; } } prm.notifyPageReceived(p.getPageNumber()); updateStreamStatus(); if (isReceiving() && !isRebroadcasting()) startRebroadcast(); if (pageBuf.getLastContiguousPage() == (pageBuf.getTotalPages() - 1)) receptionCompleted(); }