| 26 | { |
| 27 | |
| 28 | int Node :: RunNode(const Options & oOptions, Node *& poNode) |
| 29 | { |
| 30 | if (oOptions.bIsLargeValueMode) |
| 31 | { |
| 32 | InsideOptions::Instance()->SetAsLargeBufferMode(); |
| 33 | } |
| 34 | |
| 35 | InsideOptions::Instance()->SetGroupCount(oOptions.iGroupCount); |
| 36 | |
| 37 | poNode = nullptr; |
| 38 | NetWork * poNetWork = nullptr; |
| 39 | |
| 40 | Breakpoint::m_poBreakpoint = nullptr; |
| 41 | BP->SetInstance(oOptions.poBreakpoint); |
| 42 | |
| 43 | PNode * poRealNode = new PNode(); |
| 44 | int ret = poRealNode->Init(oOptions, poNetWork); |
| 45 | if (ret != 0) |
| 46 | { |
| 47 | delete poRealNode; |
| 48 | return ret; |
| 49 | } |
| 50 | |
| 51 | //step1 set node to network |
| 52 | //very important, let network on recieve callback can work. |
| 53 | poNetWork->m_poNode = poRealNode; |
| 54 | |
| 55 | //step2 run network. |
| 56 | //start recieve message from network, so all must init before this step. |
| 57 | //must be the last step. |
| 58 | poNetWork->RunNetWork(); |
| 59 | |
| 60 | |
| 61 | poNode = poRealNode; |
| 62 | |
| 63 | return 0; |
| 64 | } |
| 65 | |
| 66 | } |
| 67 | |