aboutsummaryrefslogtreecommitdiff
path: root/src/network/serverpackethandler.cpp
Commit message (Expand)AuthorAge
* Block & report player self-interaction (#11137)Lars Müller2021-03-30
* Check for duplicate login in TOSERVER_INIT handler (#11017)Elias Fleckenstein2021-03-19
* Protect dropping from far node inventoriesSmallJoker2021-03-07
* Protect per-player detached inventory actionsSmallJoker2021-03-07
* Server-side authority for attached players (#10952)SmallJoker2021-02-15
* Encode high codepoints as surrogates to safely transport wchar_t over networksfan52021-02-02
* Drop wide/narrow conversion functionssfan52021-02-02
* Server GotBlocks(): Lock clients to avoid multithreading issuesSmallJoker2021-02-02
* Cache client IP in RemoteClient so it can always be retrieved (#10887)sfan52021-01-31
* Fix some minor code issues all over the placesfan52020-12-24
* serverpackethandler: Minor log message fixessfan52020-11-12
* Fix object interaction distance not being checked (#10547)rubenwardy2020-11-09
* Inventory: Protect Craft and Drop actions (#10353)SmallJoker2020-09-07
* Prevent interacting with items out of the hotbar (#10359)Lejo2020-09-04
* [2] Code cleanup in serverpackethandler (#9349)HybridDog2020-09-01
* Prevent players accessing inventories of other players (#10341)Lars Müller2020-08-29
* Allow binding dig, place actions to keys; remove LMB/RMB hardcodingANAND2020-08-15
* Exposing the zoom key to Lua API (#9903)Lars Müller2020-06-13
* Add on_authplayer callback and 'last_login' to on_joinplayer (#9574)sorcerykid2020-05-23
* Log protocol ver on mismatched client connect toosfan52020-05-16
* Server class code cleanups (#9769)Loïc Blot2020-05-07
* Server: Improve some log messages (#9820)sfan52020-05-05
* Add server side translations capability (#9733)EvidenceB Kidscode2020-04-25
* serverpackethandler: Reduce pkt->getPeerId() invocations and more (#9689)HybridDog2020-04-18
* Move PlayerSAO to dedicated filesLoic Blot2020-04-11
* Fixes around ServerActiveObject on_punch handlingsfan52020-03-05
* Call on_secondary_use when object is right-clickedsfan52019-11-10
* Fix broken buildsfan52019-09-23
* Punchwear (improved) (#8959)sfan52019-09-22
* Wieldhand: Specify which ItemStack to use (#8961)SmallJoker2019-09-21
* Remove incorrect MutexAutoLocksfan52019-09-19
* Send ActiveObjects once right after Init2ANAND2019-09-14
* Formspecs: Introduce formspec_version to modsSmallJoker2019-09-14
* Send cumulated inventory changes only each step (#8856)SmallJoker2019-09-09
* Inventory: Send dirty lists where appropriate (#8742)SmallJoker2019-08-24
* Merge pull request #8776 from osjc/FixGetNodeJozef Behran2019-08-10
* Client::Interact: Use InteractAction enum instead of numeric constantsANAND2019-08-07
* Unify wield item handling (#8677)SmallJoker2019-08-07
* Damage: Play no damage sound when immortal (#8350)SmallJoker2019-06-09
* Optimize interaction distance checker (#8193)Jozef Behran2019-03-07
* Consistent HP and damage types (#8167)SmallJoker2019-02-10
* Fix various bugs (Anticheat, Lua helpers) (#8013)SmallJoker2019-01-06
* Send only changed node metadata to clients instead of whole mapblock (#5268)SmallJoker2018-12-04
* Add Lua methods 'set_rotation()' and 'get_rotation()' (#7395)CoderForTheBetter2018-11-28
* Formspecs: Remove accidental empty 'quit' fieldSmallJoker2018-07-10
* Rename CSM flavours to restrictionsSmallJoker2018-06-26
* Server: move shutdown parts to a specific shutdown state object (#7437)Loïc Blot2018-06-13
* Formspec verification: Fix show_formspec inside callbacks (#7374)SmallJoker2018-05-26
* Add reasons to on_dieplayer and on_hpchangeAndrew Ward2018-03-28
* Fix an alone if to be with a missing elseLoic Blot2018-03-16
&key, Caller caller, CallerData callerdata, ResultQueue<Key, T, Caller, CallerData> *dest) { typename std::deque<GetRequest<Key, T, Caller, CallerData> >::iterator i; typename std::list<CallerInfo<Caller, CallerData, Key, T> >::iterator j; { MutexAutoLock lock(m_queue.getMutex()); /* If the caller is already on the list, only update CallerData */ for (i = m_queue.getQueue().begin(); i != m_queue.getQueue().end(); ++i) { GetRequest<Key, T, Caller, CallerData> &request = *i; if (request.key != key) continue; for (j = request.callers.begin(); j != request.callers.end(); ++j) { CallerInfo<Caller, CallerData, Key, T> &ca = *j; if (ca.caller == caller) { ca.data = callerdata; return; } } CallerInfo<Caller, CallerData, Key, T> ca; ca.caller = caller; ca.data = callerdata; ca.dest = dest; request.callers.push_back(ca); return; } } /* Else add a new request to the queue */ GetRequest<Key, T, Caller, CallerData> request; request.key = key; CallerInfo<Caller, CallerData, Key, T> ca; ca.caller = caller; ca.data = callerdata; ca.dest = dest; request.callers.push_back(ca); m_queue.push_back(request); } GetRequest<Key, T, Caller, CallerData> pop(unsigned int timeout_ms) { return m_queue.pop_front(timeout_ms); } GetRequest<Key, T, Caller, CallerData> pop() { return m_queue.pop_frontNoEx(); } void pushResult(GetRequest<Key, T, Caller, CallerData> req, T res) { for (typename std::list<CallerInfo<Caller, CallerData, Key, T> >::iterator i = req.callers.begin(); i != req.callers.end(); ++i) { CallerInfo<Caller, CallerData, Key, T> &ca = *i; GetResult<Key,T,Caller,CallerData> result; result.key = req.key; result.item = res; result.caller.first = ca.caller; result.caller.second = ca.data; ca.dest->push_back(result); } } private: MutexedQueue<GetRequest<Key, T, Caller, CallerData> > m_queue; }; class UpdateThread : public Thread { public: UpdateThread(const std::string &name) : Thread(name + "Update") {} ~UpdateThread() = default; void deferUpdate() { m_update_sem.post(); } void stop() { Thread::stop(); // give us a nudge m_update_sem.post(); } void *run() { BEGIN_DEBUG_EXCEPTION_HANDLER while (!stopRequested()) { m_update_sem.wait(); // Set semaphore to 0 while (m_update_sem.wait(0)); if (stopRequested()) break; doUpdate(); } END_DEBUG_EXCEPTION_HANDLER return NULL; } protected: virtual void doUpdate() = 0; private: Semaphore m_update_sem; };