31 #line 32 "ObGateway.cc"
34 myIdentity(*myIdentityArg), so_sndbuf(16777216), ismultinode(false)
48 boost::unordered_map< int64_t, vector<string *> > pendingMsgs;
52 bool isserstrbig=
false;
60 for (
size_t inmsg=0; inmsg < 5000; inmsg++)
87 for (
short n=0; n<msgRef.
nmsgs; n++)
95 printf(
"%s %i anomaly %i\n", __FILE__, __LINE__,
101 boost::unordered_map< int64_t, vector<string *> >::iterator it;
102 for (it=pendingMsgs.begin(); it != pendingMsgs.end(); ++it)
104 vector<string *> &msgsRef = it->second;
105 size_t s=
sizeof(size_t);
106 for (
size_t n=0; n < msgsRef.size(); n++)
108 s +=
sizeof(size_t) + msgsRef[n]->
size();
117 serstrbig=
new (std::nothrow)
char[s];
126 memcpy(serstr, &s,
sizeof(s));
127 size_t pos=
sizeof(s);
128 for (
size_t n=0; n < msgsRef.size(); n++)
130 string &msgRef=*msgsRef[n];
131 size_t ms=msgRef.size();
132 memcpy(serstr+pos, &ms,
sizeof(ms));
133 pos +=
sizeof(size_t);
134 memcpy(serstr+pos, msgRef.c_str(), ms);
142 int cbound=LZ4_compressBound(s);
145 cstrbig=
new (std::nothrow)
char[cbound+
sizeof(
size_t)];
154 size_t csize=LZ4_compress(serstr, cstr+
sizeof(csize), s);
155 csize +=
sizeof(csize);
156 memcpy(cstr, &csize,
sizeof(csize));
171 pendingMsgs.erase(it->first);
173 if (isserstrbig==
true)
193 map< int64_t, vector<string> >::iterator it;
204 vector<string> &vecstringRef = it->second;
229 struct addrinfo hints;
230 memset(&hints, 0,
sizeof(
struct addrinfo));
231 hints.ai_family = AF_INET;
232 hints.ai_socktype = SOCK_STREAM;
233 hints.ai_flags = AI_PASSIVE;
234 struct addrinfo *servinfo;
236 if (getaddrinfo(node.c_str(), service.c_str(), &hints,
239 fprintf(
logfile,
"%s %i getaddrinfo\n", __FILE__, __LINE__);
243 sockfd = socket(servinfo->ai_family, servinfo->ai_socktype,
244 servinfo->ai_protocol);
247 fprintf(
logfile,
"%s %i socket\n", __FILE__, __LINE__);
251 if (connect(sockfd, servinfo->ai_addr, servinfo->ai_addrlen))
253 fprintf(
logfile,
"%s %i connect errno %i '%s:%s'\n", __FILE__,
254 __LINE__, errno, node.c_str(), service.c_str());
258 if (setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &
so_sndbuf,
261 fprintf(
logfile,
"%s %i setsockopt errno %i\n", __FILE__,
266 freeaddrinfo(servinfo);