feat: make sniffing async
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
from signal import pause
|
||||
|
||||
from star_resonance_tracer.proto.enum_chit_chat_msg_type_pb2 import ChitChatMsgType
|
||||
from star_resonance_tracer.proto.serv_chit_chat_ntf_pb2 import ChitChatNtf as ChitChatNtfPb
|
||||
from star_resonance_tracer.proto.stru_place_holder_item_pb2 import PlaceHolderItem
|
||||
from star_resonance_tracer.sniffer import Sniffer
|
||||
|
||||
from inventory_wars.const import ChitChatNtf, decode_placeholder, HypertextVariant
|
||||
from inventory_wars.sniffer import start_sniffing
|
||||
from star_resonance_tracer.proto.serv_chit_chat_ntf_pb2 import ChitChatNtf as ChitChatNtfPb
|
||||
from inventory_wars.sniffer import get_sniffer
|
||||
|
||||
|
||||
def on_chit_chat_msg(event: ChitChatNtfPb.NotifyNewestChitChatMsgs) -> None:
|
||||
@@ -24,7 +26,6 @@ def on_chit_chat_msg(event: ChitChatNtfPb.NotifyNewestChitChatMsgs) -> None:
|
||||
print(item)
|
||||
|
||||
|
||||
|
||||
sniffer = Sniffer()
|
||||
sniffer.set_service_type(
|
||||
ChitChatNtf.ServiceId.value,
|
||||
@@ -33,4 +34,7 @@ sniffer.set_service_type(
|
||||
)
|
||||
sniffer.on_service(ChitChatNtfPb.NotifyNewestChitChatMsgs, on_chit_chat_msg)
|
||||
|
||||
start_sniffing(sniffer)
|
||||
scapy = get_sniffer(sniffer)
|
||||
scapy.start()
|
||||
|
||||
pause()
|
||||
|
||||
Reference in New Issue
Block a user