Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
3cef97cb
Commit
3cef97cb
authored
May 07, 2015
by
Björn Richerzhagen
Browse files
PiggyBackService: fixed null-pointer on piggyback-receive if no local
service is registered.
parent
5964bc4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/transport/modular/ModularTransLayer.java
View file @
3cef97cb
...
...
@@ -99,7 +99,7 @@ public class ModularTransLayer implements SimHostComponent, TransportComponent,
public
static
AvgAccumulatorTime
_avgSendAndWaitTime
=
new
AvgAccumulatorTime
(
"Trans avg. SaW Delay"
,
1000
);
public
static
AvgAccumulatorDouble
_avgSendAndWaitSuccess
=
new
AvgAccumulatorDouble
(
"Trans avg. SaW Success"
,
1000
);
...
...
@@ -319,8 +319,7 @@ public class ModularTransLayer implements SimHostComponent, TransportComponent,
for
(
PiggybackMessageService
pService
:
piggybackServices
.
values
())
{
piggybacked
=
pService
.
piggybackOnSendMessage
(
receiverNet
,
receiverPort
,
ProtocolAdapter
.
this
);
receiverPort
,
ProtocolAdapter
.
this
);
if
(
piggybacked
!=
null
)
{
if
(
mPig
==
null
)
{
mPig
=
new
MessageWithPiggybackedData
(
msg
);
...
...
@@ -430,7 +429,6 @@ public class ModularTransLayer implements SimHostComponent, TransportComponent,
}
}
/*
* Notify the Protocol of a received Message
*/
...
...
@@ -465,7 +463,8 @@ public class ModularTransLayer implements SimHostComponent, TransportComponent,
// triggered once
if
(
receivedMessage
.
getPayload
()
instanceof
MessageWithPiggybackedData
)
{
MessageWithPiggybackedData
pMsg
=
(
MessageWithPiggybackedData
)
receivedMessage
.
getPayload
();
MessageWithPiggybackedData
pMsg
=
(
MessageWithPiggybackedData
)
receivedMessage
.
getPayload
();
/*
* Deliver piggybacked messages
*/
...
...
@@ -478,8 +477,8 @@ public class ModularTransLayer implements SimHostComponent, TransportComponent,
// deliver real message
replyEvent
.
success
(
pMsg
.
getPayload
(),
senderInfo
);
}
else
{
replyEvent
.
success
(
receivedMessage
.
getPayload
(),
senderInfo
);
replyEvent
.
success
(
receivedMessage
.
getPayload
(),
senderInfo
);
}
}
/*
...
...
@@ -497,13 +496,15 @@ public class ModularTransLayer implements SimHostComponent, TransportComponent,
MessageWithPiggybackedData
pMsg
=
(
MessageWithPiggybackedData
)
receivedMessage
.
getPayload
();
/*
* Deliver piggybacked messages
* Deliver piggybacked messages, but only if we have a local
* listener. Discard otherwise.
*/
for
(
Entry
<
Byte
,
Message
>
entry
:
pMsg
.
getPiggybacked
()
.
entrySet
())
{
piggybackServices
.
get
(
entry
.
getKey
())
.
onReceivedPiggybackedMessage
(
entry
.
getValue
(),
senderInfo
);
PiggybackMessageService
service
=
piggybackServices
.
get
(
entry
.
getKey
());
if
(
service
!=
null
)
{
service
.
onReceivedPiggybackedMessage
(
entry
.
getValue
(),
senderInfo
);
}
}
// deliver real message
pl
.
dispatch
(
pMsg
.
getPayload
(),
protocol
,
senderInfo
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment