Homework 1 forum

Callback function for private messages (GUI)

 
Picture of Pasindu Nivanthaka Tennage
Re: Callback function for private messages (GUI)
by Pasindu Nivanthaka Tennage - Wednesday, 28 October 2020, 13:57
 

Hello

Yes you are right, this is a slight issue with the code we provided. As a work around, I suggest you to do the following, upon receiving the private message at destination.

rumourMessage := RumorMessage{

Origin: priv.Origin,

ID:     priv.ID,

Text:   priv.Text,

}


if g.callback != nil {

g.callback(g.identifier, GossipPacket{Rumor: &rumourMessage})

}

Hope this answers your question