Commit 436e32f9676e522c42ca49d6ae17b48a3d4dd751

  • avatar
  • Sergey 'Jin' Bostandzhyan <jin @deve…per.digitalstrom.org>
  • Tue Sep 07 11:31:38 CEST 2010
Better function naming

As discussed, renamed blockingCallback() to startBlockingCall() and
leavingBlockingCallback() to endBlockingCall()
core/scripting/jssocket.cpp
(12 / 12)
  
134134 }
135135
136136 protected:
137 void blockingCallback() {
137 void startBlockingCall() {
138138 m_pAttachedObject.reset(new ScriptContextAttachedObject(&getContext()));
139139 }
140140
141 void leavingBlockingCallback() {
141 void endBlockingCall() {
142142 m_pAttachedObject.reset();
143143 }
144144 protected:
191191 this,
192192 boost::asio::placeholders::error,
193193 ++iterator));
194 blockingCallback();
194 startBlockingCall();
195195 startIOThread();
196196 }
197197
206206 this,
207207 boost::asio::placeholders::error,
208208 boost::asio::placeholders::bytes_transferred));
209 blockingCallback();
209 startBlockingCall();
210210 startIOThread();
211211 }
212212
213213 void close() {
214214 m_pSocket->close();
215 leavingBlockingCallback();
215 endBlockingCall();
216216 }
217217
218218 void receive(const int _numberOfBytes) {
226226 this,
227227 boost::asio::placeholders::error,
228228 boost::asio::placeholders::bytes_transferred));
229 blockingCallback();
229 startBlockingCall();
230230 startIOThread();
231231 }
232232
253253 if(m_pSocket == NULL && m_pAcceptor != NULL) {
254254 createSocket();
255255 m_pAcceptor->async_accept(*m_pSocket, boost::bind(&SocketHelperInstance::acceptCallback, this, boost::asio::placeholders::error));
256 blockingCallback();
256 startBlockingCall();
257257 startIOThread();
258258 } else {
259259 Logger::getInstance()->log("SocketHelperInstance::accept: Please call bind first", lsFatal);
265265 tcp::resolver::iterator endpoint_iterator) {
266266 Logger::getInstance()->log("*** Connection callback");
267267 AssertLocked lock(&getContext());
268 leavingBlockingCallback();
268 endBlockingCall();
269269 //JS_SetContextThread(getContext().getJSContext());
270270 JSRequest req(getContext().getJSContext());
271271 if (!error) {
288288 void sendCallback(const boost::system::error_code& error, std::size_t bytesTransfered) {
289289 Logger::getInstance()->log("*** Send callback");
290290 AssertLocked lock(&getContext());
291 leavingBlockingCallback();
291 endBlockingCall();
292292 //JS_SetContextThread(getContext().getJSContext());
293293 JSRequest req(getContext().getJSContext());
294294 if(!error) {
311311 JSRequest req(getContext().getJSContext());
312312 if(!error) {
313313 if(bytesTransfered == m_BytesToRead) {
314 leavingBlockingCallback();
314 endBlockingCall();
315315 std::string result(m_DataBuffer, m_BytesToRead);
316316 callDataCallback(result);
317317 m_BytesToRead = 0;
318318 }
319319 } else {
320 leavingBlockingCallback();
320 endBlockingCall();
321321 Logger::getInstance()->log("SocketHelperInstance::readCallback: error: " + error.message());
322322 callDataCallback("");
323323 }
327327
328328 void acceptCallback(const boost::system::error_code& error) {
329329 AssertLocked lock(&getContext());
330 leavingBlockingCallback();
330 endBlockingCall();
331331 //JS_SetContextThread(getContext().getJSContext());
332332 JSRequest req(getContext().getJSContext());
333333 if(!error) {