On Friday 14 November 2008 00:20, Daniel Cheng wrote:
> On Fri, Nov 14, 2008 at 7:39 AM, <toad at freenetproject.org> wrote:
> > Author: toad
> > Date: 2008-11-13 23:39:17 +0000 (Thu, 13 Nov 2008)
> > New Revision: 23542
> >
> > Modified:
> > trunk/freenet/src/freenet/node/FNPPacketMangler.java
> > trunk/freenet/src/freenet/node/OutgoingPacketMangler.java
> > trunk/freenet/src/freenet/node/PeerNode.java
> > Log:
> > Send a packet even if we get a WouldBlockException...
> >
> >
> > Modified: trunk/freenet/src/freenet/node/PeerNode.java
> > ===================================================================
> > --- trunk/freenet/src/freenet/node/PeerNode.java 2008-11-13
20:02:47 UTC (rev 23541)
> > +++ trunk/freenet/src/freenet/node/PeerNode.java 2008-11-13
23:39:17 UTC (rev 23542)
> > @@ -2407,7 +2407,7 @@
> > * @throws PacketSequenceException If there is an error sending the
packet
> > * caused by a sequence inconsistency.
> > */
> > - public boolean sendAnyUrgentNotifications(boolean
forceSendPrimary) throws PacketSequenceException {
> > + public boolean sendAnyUrgentNotifications(boolean
forceSendPrimary) {
> > boolean sent = false;
> > if(logMINOR)
> > Logger.minor(this, "sendAnyUrgentNotifications");
> > @@ -2433,6 +2433,8 @@
> > // Ignore
> > } catch(WouldBlockException e) {
> > // Impossible, ignore
> > + } catch(PacketSequenceException e) {
> > + // Impossible, ignore
>
> better log the impossible error
Done.
>
> > }
> > }
> > }
> > @@ -2451,6 +2453,8 @@
> > // Ignore
> > } catch(WouldBlockException e) {
> > Logger.error(this, "Impossible: " +
e, e);
> > + } catch(PacketSequenceException e) {
> > + // Impossible, ignore
>
> same here
Also done.
>
> > }
> > }
> > return sent;
> > @@ -4014,10 +4018,12 @@
> > public boolean maybeSendPacket(long now, Vector<ResendPacketItem>
rpiTemp, int[] rpiIntTemp) {
> > // If there are any urgent notifications, we must send a
packet.
> > boolean mustSend = false;
> > + boolean mustSendPacket = false;
> > if(mustSendNotificationsNow(now)) {
> > if(logMINOR)
> > Logger.minor(this, "Sending notification");
> > mustSend = true;
> > + mustSendPacket = true;
> > }
> > // Any packets to resend? If so, resend ONE packet and then
return.
> > for(int j = 0; j < 2; j++) {
> > @@ -4074,6 +4080,7 @@
> > Logger.minor(this, "Sending keepalive");
> > keepalive = true;
> > mustSend = true;
> > + mustSendPacket = true;
> > }
> >
> > ArrayList<MessageItem> messages = new
ArrayList<MessageItem>(10);
> > @@ -4122,17 +4129,17 @@
> > // Send packets, right now, blocking, including any
active notifications
> > // Note that processOutgoingOrRequeue will drop
messages from the end
> > // if necessary to fit the messages into a single
packet.
> > -
getOutgoingMangler().processOutgoingOrRequeue(messages.toArray(new
MessageItem[messages.size()]), this, true, false, true);
> > +
if(!getOutgoingMangler().processOutgoingOrRequeue(messages.toArray(new
MessageItem[messages.size()]), this, true, false, true)) {
> > + if(mustSendPacket) {
> > +
if(!sendAnyUrgentNotifications(false))
> > +
sendAnyUrgentNotifications(true);
> > + }
> > + }
> > return true;
> > } else {
> > if(mustSend) {
> > - try {
> >
if(sendAnyUrgentNotifications(false))
> > return true;
> > - } catch (PacketSequenceException e) {
> > - Logger.error(this, "Caught "+e,
e);
> > - return false;
> > - }
> > // Can happen occasionally as a race
condition...
> > Logger.normal(this, "No notifications sent
despite no messages and mustSend=true for "+this);
> > }
> >
> > _______________________________________________
> > cvs mailing list
> > cvs at freenetproject.org
> > http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
> >
> _______________________________________________
> Devl mailing list
> Devl at freenetproject.org
> http://emu.freenetproject.org/cgi-bin/mailman/listinfo/devl
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL:
<https://emu.freenetproject.org/pipermail/devl/attachments/20081114/34a77d1f/attachment.pgp>