0

what data stored in sessionMap

asked 2014-08-12 02:01:29 -0700

JeremyLi gravatar image

updated 2014-08-12 02:02:55 -0700

I read some source codes of alljoyn and there are some confusion. sessionMap.insert(pair<pair<string, sessionid="">, SessionMapEntry>(key, sme)); 1. what String means in the above code line, dose it stand for the joiner's name ? and what's the meaning of the data stored in the sessionMap ? 2. why dose the code to check if a creator of a session is joining itself check the sessionid == 0 ? what means if the sessionid == 0 in the sessionMap ? 3. why dose add two entries when join a session ?(creator side entry and joiner side entry), and what are the functions of the two entries ?</pair<string,>

edit retag flag offensive close merge delete

Comments

there is a vector in SessionMapEntry std::vector<qcc::string> memberNames; when the session is not multipiont, the memberNames contains which members ? why the code call memberNames.push_back(sender) twice ?

JeremyLi ( 2014-08-12 02:39:47 -0700 )edit

@JeremyLi, what code are you looking at, can you please add a reference to the code you are commenting on?

bspencer ( 2014-08-12 09:37:32 -0700 )edit

i'm looking at code of alljoyn framework, the file is alljoynObj.cc and the method is RunJoin

JeremyLi ( 2014-08-12 20:42:18 -0700 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-08-15 10:22:43 -0700

sheshamb gravatar image

Some background: The bind API(BusAttachment::BindSessionPort) is used by a host application to bind a port that will be used by joiners while making the BusAttachment::JoinSession method call. The host application MUST call BindSessionPort if it wants joiners to be able to join a session to it.

SessionMap maps a std::pair of qcc::String and SessionId to a SessionMapEntry. For simplicity, lets call the qcc::String as "name".

Entries are added into the sessionMap in the following circumstances:

  1. AllJoynObj::BindSessionPort(AllJoynObj.cc:433): This is called when an AllJoyn service calls BusAttachment::BindSessionPort. The code (while loop in AllJoynObj.cc:415) checks to see if the caller has already called BindSessionPort with the same port, and returns an ALLJOYN_BINDSESSIONPORT_REPLY_ALREADY_EXISTS error in that case. If not, a sessionMap entry is created with the name as the caller to BindSessionPort and sessionId as 0.
  2. AllJoynObj::JoinSessionThread::RunJoin(AllJoynObj.cc:664): This adds a creator side entry since the creator is also locally connected to the Routing Node(RN). i.e. in this case the session creator and session joiner are connected to the same RN. Entry is added with name of the creator and the newly allocated sessionId.
  3. AllJoynObj::JoinSessionThread::RunJoin(AllJoynObj.cc:719): This adds a joiner side entry to the sessionMap for a session created with SessionOpts::TRAFFIC_MESSAGES. In this case the session creator and session joiner are connected to the same RN.Entry is added with name of the joiner and the newly allocated sessionId.
  4. AllJoynObj::JoinSessionThread::RunJoin(AllJoynObj.cc:742): This adds a joiner side entry to the sessionMap for a raw session.In this case the session creator and session joiner are connected to the same RN. Entry is added with name of the joiner and the newly allocated sessionId.
  5. AllJoynObj::JoinSessionThread::RunJoin(AllJoynObj.cc:980): This adds a joiner side entry to the sessionMap for a raw session.In this case the session creator and session joiner are connected to the different RNs. Entry is added with name of the creator and the sessionId obtained from the creator by calling the ajObj.SendAttachSession method Call on line AllJoynObj.cc:930.
  6. AllJoynObj::JoinSessionThread::RunAttach(AllJoynObj.cc:1589): This adds a creator side entry in the case that the session creator and session joiner are connected to the different RNs. Entry is added with name of the creator and the newly allocated sessionId.

Coming back to your questions:

  1. what String means in the above code line, dose it stand for the joiner's name ? and what's the meaning of the data stored in the sessionMap ? Please find answers to this above.

  2. why dose the code to check if a creator of a session is joining itself check the sessionid == 0 ? what means if the sessionid == 0 in the sessionMap ? I believe that the case you are talking about is in the while loop AllJoynObj.cc:612. In this case, since the creator is also local to the RN, the RN is verifying that the ...

(more)
edit flag offensive delete publish link more

Comments

how many entries are there when a creator create a session and 3 joiner joined in the session? In the sessionMapEntry, the memberNames vector contains the members already joined in the session, if there are 4 entries in the sessionMap, when a joiner joined, does it need to add the joiner 4 times?

JeremyLi ( 2014-08-17 18:28:05 -0700 )edit

and what a raw session means?

JeremyLi ( 2014-08-17 18:35:41 -0700 )edit

what's the relationship and difference between VirtualEndpoint and RemoteEndpoint?

JeremyLi ( 2014-08-17 18:40:26 -0700 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-08-12 02:01:29 -0700

Seen: 127 times

Last updated: Aug 15 '14